diff --git a/.github/workflows/python-package-conda.yml b/.github/workflows/python-package-conda.yml index e276185..2cc1305 100644 --- a/.github/workflows/python-package-conda.yml +++ b/.github/workflows/python-package-conda.yml @@ -22,8 +22,8 @@ jobs: strategy: fail-fast: False matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + os: [ubuntu-latest, macos-latest-large, windows-latest] + python-version: ["3.10", "3.11", "3.12"] mkl-version: ['2023'] # currently 2024 fails building for some reason... include: - os: ubuntu-latest @@ -55,7 +55,7 @@ jobs: - name: Create environment run: | - mamba install --quiet --yes pip numpy scipy cython mkl=${{ matrix.mkl-version }} pytest \ + conda install --quiet --yes pip numpy scipy cython mkl=${{ matrix.mkl-version }} pytest \ mkl-devel pkg-config meson-python meson ninja setuptools_scm \ ${{ matrix.coverage && 'coverage' || ''}} @@ -63,7 +63,7 @@ jobs: run: | python -m pip install --no-build-isolation --verbose --editable . \ --config-setting=compile-args=-v \ - ${{ matrix.coverage && '--config-settings=setup-args="-Dcy_coverage=true"' || ''}} + ${{ matrix.coverage && '--config-settings=setup-args="-Db_coverage=true"' || ''}} conda list - name: Run Tests @@ -107,7 +107,7 @@ jobs: - name: Create environment run: | - mamba install --quiet --yes pip numpy scipy cython mkl=2023 \ + conda install --quiet --yes pip numpy scipy cython mkl=2023 \ mkl-devel pkg-config meson-python meson ninja setuptools_scm \ python-build diff --git a/meson.build b/meson.build index 3303d66..29b269a 100644 --- a/meson.build +++ b/meson.build @@ -14,7 +14,7 @@ print(get_version())''' ).stdout().strip(), license: 'MIT', - meson_version: '>= 1.1.0', + meson_version: '>= 1.4.0', default_options: [ 'buildtype=debugoptimized', 'b_ndebug=if-release', diff --git a/meson.options b/meson.options index f3968b5..6440a29 100644 --- a/meson.options +++ b/meson.options @@ -1,5 +1,3 @@ -option('cy_coverage', type : 'boolean', value : false) - option('use-sdl', type: 'boolean', value: true, description: 'Use the single dynamic library.') diff --git a/pydiso/meson.build b/pydiso/meson.build index fd7f01c..67c9464 100644 --- a/pydiso/meson.build +++ b/pydiso/meson.build @@ -1,38 +1,5 @@ # NumPy include directory -# The try-except is needed because when things are -# split across drives on Windows, there is no relative path and an exception -# gets raised. There may be other such cases, so add a catch-all and switch to -# an absolute path. Relative paths are needed when for example a virtualenv is -# placed inside the source tree; Meson rejects absolute paths to places inside -# the source tree. -# For cross-compilation it is often not possible to run the Python interpreter -# in order to retrieve numpy's include directory. It can be specified in the -# cross file instead: -# [properties] -# numpy-include-dir = /abspath/to/host-pythons/site-packages/numpy/core/include -# -# This uses the path as is, and avoids running the interpreter. -incdir_numpy = meson.get_external_property('numpy-include-dir', 'not-given') -if incdir_numpy == 'not-given' - incdir_numpy = run_command(py, - [ - '-c', - '''import os -import numpy as np -try: - incdir = os.path.relpath(np.get_include()) -except Exception: - incdir = np.get_include() -print(incdir) - ''' - ], - check: true - ).stdout().strip() -else - _incdir_numpy_abs = incdir_numpy -endif -inc_np = include_directories(incdir_numpy) -np_dep = declare_dependency(include_directories: inc_np) +np_dep = dependency('numpy') # MKL-specific options mkl_dep_name = 'mkl-dynamic' @@ -87,15 +54,12 @@ else use_math_defines = [] endif -numpy_nodepr_api = '-DNPY_NO_DEPRECATED_API=NPY_1_9_API_VERSION' c_undefined_ok = ['-Wno-maybe-uninitialized'] - -cython_c_args = [numpy_nodepr_api, use_math_defines]\ +cython_c_args = [numpy_nodepr_api, use_math_defines, '-DCYTHON_CCOMPLEX=0'] cython_file = 'mkl_solver.pyx' -cython_file_full_path = meson.current_source_dir() / cython_file -if get_option('cy_coverage') +if get_option('b_coverage') # tell cython to enable linetracing add_project_arguments(['--directive', 'linetrace=true'], language : 'cython') # tell the c_compiler to definie the CYTHON_TRACE_NOGIL @@ -103,6 +67,7 @@ if get_option('cy_coverage') # compile the .c file from the .pyx file in it's directory. # These should include the default options passed to the cython compiler + cython_file_full_path = meson.current_source_dir() / cython_file run_command(cython, '-M', '--fast-fail', '-3', '--directive', 'linetrace=true', cython_file_full_path) endif @@ -111,7 +76,6 @@ module_path = 'pydiso' py.extension_module( 'mkl_solver', cython_file, - include_directories: incdir_numpy, c_args: cython_c_args, install: true, subdir: module_path, diff --git a/pyproject.toml b/pyproject.toml index 0178128..e0d3b8b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,31 +2,10 @@ [build-system] build-backend = 'mesonpy' requires = [ - "meson-python>=0.14.0", - "Cython>=0.29.35", # when updating version, also update check in meson.build + "meson-python>=0.15.0", + "Cython>=3.0.8", "setuptools_scm[toml]>=6.2", - - # This package automatically provides all of the numpy pinning for different python - # versions and runtime requirements. - "oldest-supported-numpy", - - # The following is taken from scipy's pyproject.toml file to handle - # building against the proper numpy API - - # When numpy 2.0.0rc1 comes out, we should update this to build against 2.0, - # and then runtime depend on the range 1.22.X to <2.3. No need to switch to - # 1.25.2 in the meantime (1.25.x is the first version which exports older C - # API versions by default). - - # default numpy requirements - # "numpy==1.22.4; python_version<='3.10' and platform_python_implementation != 'PyPy'", - # "numpy==1.23.2; python_version=='3.11' and platform_python_implementation != 'PyPy'", - - # For Python versions which aren't yet officially supported, we specify an - # unpinned NumPy which allows source distributions to be used and allows - # wheels to be used as soon as they become available. - # "numpy>=1.26.0b1; python_version>='3.12'", - # "numpy; python_version>='3.8' and platform_python_implementation=='PyPy'", + "numpy>=2.0.0rc1", ] [project]