diff --git a/.coveragerc b/.coveragerc.meson similarity index 100% rename from .coveragerc rename to .coveragerc.meson diff --git a/.coveragerc.setuptools b/.coveragerc.setuptools new file mode 100644 index 00000000..d9a48b4b --- /dev/null +++ b/.coveragerc.setuptools @@ -0,0 +1,2 @@ +[run] +plugins = Cython.Coverage diff --git a/.github/workflows/buildwheel.yml b/.github/workflows/buildwheel.yml index 49ca28d0..40a66e50 100644 --- a/.github/workflows/buildwheel.yml +++ b/.github/workflows/buildwheel.yml @@ -17,7 +17,7 @@ jobs: - uses: actions/setup-python@v5 with: - python-version: '3.12' + python-version: '3.13' - uses: msys2/setup-msys2@v2 with: @@ -65,7 +65,7 @@ jobs: - uses: actions/setup-python@v5 with: - python-version: '3.12' + python-version: '3.13' - run: bin/install_latest_flint_ubuntu.sh - run: pip install build @@ -111,7 +111,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: '3.12' + python-version: '3.13' - run: sudo apt-get update - run: sudo apt-get install libflint-dev - run: pip install . @@ -124,7 +124,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: '3.12' + python-version: '3.13' - run: bin/install_latest_flint_ubuntu.sh - run: pip install --upgrade pip - run: pip install -r requirements-dev.txt @@ -139,7 +139,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: '3.12' + python-version: '3.13' - run: sudo apt-get update - run: sudo apt-get install libflint-dev # The versions of cython and meson-python here should be kept in sync @@ -149,7 +149,7 @@ jobs: # We don't need to specify ninja as a requirement in pyproject.toml # because without --no-build-isolation meson-python handles it # automatically in get_requirements_for_build_wheel(). - - run: 'pip install "cython==3.0" "meson-python==0.13" "ninja<1.11"' + - run: 'pip install "cython==3.0.11" "meson-python==0.13" "ninja<1.11"' - run: pip install --no-build-isolation . - run: python -m flint.test --verbose @@ -166,7 +166,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: '3.12' + python-version: '3.13' - run: bin/install_flint_ubuntu.sh ${{ matrix.flint-tag }} - run: pip install . - run: python -m flint.test --verbose @@ -179,26 +179,37 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: '3.12' + python-version: '3.13' - run: bin/install_flint_ubuntu.sh main # Need to disable flint version check to build against main - run: pip install --config-settings=setup-args="-Dflint_version_check=false" . - run: python -m flint.test --verbose # Test that we can make a coverage build and report coverage - test_coverage_build: + test_coverage_build_setuptools: name: Test coverage setuptools build runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: '3.12' + python-version: '3.13' + - run: sudo apt-get update + - run: sudo apt-get install libflint-dev + - run: pip install -r requirements-dev.txt + - run: bin/coverage_setuptools.sh + + # Test that we can make a coverage build and report coverage + test_coverage_build_meson: + name: Test coverage meson build + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.12' # does not work with 3.13 - run: sudo apt-get update - run: sudo apt-get install libflint-dev - # Need Cython's master branch until 3.1 is released because of: - # https://github.com/cython/cython/pull/6341 - - run: pip install git+https://github.com/cython/cython.git@master - run: pip install -r requirements-dev.txt - run: bin/coverage.sh @@ -210,7 +221,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-24.04] - python-version: ['3.13-dev'] + python-version: ['3.13', '3.14-dev'] steps: - uses: actions/checkout@v4 # Can't use actions/setup-python @@ -245,7 +256,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: '3.12' + python-version: '3.13' - run: sudo apt-get update - run: sudo apt-get install libflint-dev - run: pip install . diff --git a/bin/activate b/bin/activate index 81e1eead..465c484f 100644 --- a/bin/activate +++ b/bin/activate @@ -1,3 +1,4 @@ export C_INCLUDE_PATH=$(pwd)/.local/include export LIBRARY_PATH=$(pwd)/.local/lib export LD_LIBRARY_PATH=$(pwd)/.local/lib +export PKG_CONFIG_PATH=$(pwd)/.local/lib/pkgconfig diff --git a/bin/coverage.sh b/bin/coverage.sh index 1c729377..651497b2 100755 --- a/bin/coverage.sh +++ b/bin/coverage.sh @@ -1,13 +1,5 @@ #!/bin/bash # -# This needs a patched Cython: -# -# pip install git+https://github.com/oscarbenjamin/cython.git@pr_relative_paths -# -# That patch has been submitted as a pull request: -# -# https://github.com/cython/cython/pull/6341 -# # Arguments to this script are passed to python -m flint.test e.g. to skip # doctests and run in quiet mode: # @@ -15,7 +7,18 @@ # set -o errexit +RC="--rcfile=.coveragerc.meson" + +# See https://github.com/cython/cython/issues/6658 +# Needed for Python 3.13 only but the plugin does not work with 3.13 anyway... +#pip uninstall -y cython +#pip install git+https://github.com/cython/cython.git@fdbca99 + +pip uninstall -y cython +pip install --pre cython # unpinned to pick up new releases in CI +# pip install cython==3.1.0a1 # known working version for Python < 3.13 + meson setup build -Dcoverage=true -spin run -- coverage run -m flint.test $@ -coverage report -m --sort=cover -coverage html +spin run -- coverage run $RC -m flint.test $@ +coverage report $RC -m --sort=cover +coverage html $RC diff --git a/bin/coverage_setuptools.sh b/bin/coverage_setuptools.sh new file mode 100755 index 00000000..dd0cd786 --- /dev/null +++ b/bin/coverage_setuptools.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +set -e + +RC="--rcfile=.coveragerc.setuptools" + +# Comment out various lines below for speed if running multiple times. + +# See https://github.com/cython/cython/issues/6658 +# Needed for Python 3.13 only +pip uninstall -y cython +pip install git+https://github.com/cython/cython.git@fdbca99 +pip install setuptools + +touch src/*/*/*.pyx +PYTHON_FLINT_COVERAGE=1 python setup.py build_ext --inplace +PYTHONPATH=src coverage run $RC -m flint.test +coverage report $RC -m --sort=cover +coverage html $RC diff --git a/coverage_plugin.py b/coverage_plugin.py index 8382dc26..e9a4e2b0 100644 --- a/coverage_plugin.py +++ b/coverage_plugin.py @@ -128,6 +128,7 @@ class CyFileTracer(FileTracer): """File tracer for Cython files (.pyx,.pxd).""" def __init__(self, srcpath): + print(srcpath) assert (src_dir / srcpath).exists() self.srcpath = srcpath diff --git a/meson.build b/meson.build index 6417ea4a..01091520 100644 --- a/meson.build +++ b/meson.build @@ -1,4 +1,9 @@ -project('python-flint', 'cython', 'c') +project( + 'python-flint', + 'cython', + 'c', + meson_version : '>=1.1', +) # # The minimum versions are because we know that it will not work with earlier # versions. The maximum versions are because python-flint was not tested @@ -8,7 +13,7 @@ project('python-flint', 'cython', 'c') # flint_lower = '>=3.0' flint_upper = '<3.2' -cython_lower = '>=3.0' +cython_lower = '>=3.0.11' cython_upper = '<3.2' py = import('python').find_installation(pure: false) diff --git a/pyproject.toml b/pyproject.toml index dc64bf2d..bfb31c5f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,7 +36,7 @@ content-type = "text/markdown" # until we have actually witnessed a Cython 3.x release that does not break the # build we should keep the upper cap. # -requires = ["meson-python>=0.13", "cython>=3.0,<3.1"] +requires = ["meson-python>=0.13", "cython>=3.0.11,<3.1"] build-backend = "mesonpy" [tool.cython-lint] diff --git a/src/flint/flintlib/types/gr.pxd b/src/flint/flintlib/types/gr.pxd index 3db145ba..84bdc8b8 100644 --- a/src/flint/flintlib/types/gr.pxd +++ b/src/flint/flintlib/types/gr.pxd @@ -8,9 +8,15 @@ from flint.flintlib.types.flint cimport ( cdef extern from *: """ /* - * The following functions were introduced in FLINT 3.2.0 + * The following functions were introduced in FLINT 3.1.0 */ + #if __FLINT_RELEASE < 30100 + #define gr_div_nonunique(res, x, y, ctx) GR_UNABLE + #endif + /* + * The following functions were introduced in FLINT 3.2.0 + */ #if __FLINT_RELEASE < 30200 #define gr_min(res, x, y, ctx) GR_UNABLE #define gr_max(res, x, y, ctx) GR_UNABLE diff --git a/src/flint/types/_gr.pyx b/src/flint/types/_gr.pyx index 83811460..1dcb76cd 100644 --- a/src/flint/types/_gr.pyx +++ b/src/flint/types/_gr.pyx @@ -1708,7 +1708,7 @@ cdef class gr(flint_scalar): >>> from flint.types._gr import gr_complex_acb_ctx >>> acb = gr_complex_acb_ctx.new(53) - >>> x = acb("pi") + >>> x = acb("2") >>> x.parent() gr_complex_acb_ctx(53) """