From 2272ebde424c724341839a040a1c69dc606c34d6 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Fri, 7 Feb 2025 23:41:10 +0000 Subject: [PATCH 01/10] test: reenable setuptools coverage build --- .coveragerc => .coveragerc.meson | 0 .coveragerc.setuptools | 2 ++ bin/activate | 1 + bin/coverage.sh | 13 ++++++++++--- bin/coverage_setuptools.sh | 16 ++++++++++++++++ 5 files changed, 29 insertions(+), 3 deletions(-) rename .coveragerc => .coveragerc.meson (100%) create mode 100644 .coveragerc.setuptools create mode 100755 bin/coverage_setuptools.sh 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/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..f73720af 100755 --- a/bin/coverage.sh +++ b/bin/coverage.sh @@ -15,7 +15,14 @@ # set -o errexit +RC="--rcfile=.coveragerc.meson" + +# See https://github.com/cython/cython/issues/6658 +# Needed for Python 3.13 only +#pip uninstall cython +#pip install git+https://github.com/cython/cython.git@fdbca99 + 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..10ec4a6f --- /dev/null +++ b/bin/coverage_setuptools.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +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 cython +#pip install git+https://github.com/cython/cython.git@fdbca99 + +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 From 9763872895c2fd3db96ccb769bef0326362d8437 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Fri, 7 Feb 2025 23:48:18 +0000 Subject: [PATCH 02/10] test: test both coverage builds in CI --- .github/workflows/buildwheel.yml | 37 +++++++++++++++++++++----------- bin/coverage.sh | 4 ++-- bin/coverage_setuptools.sh | 6 ++++-- 3 files changed, 30 insertions(+), 17 deletions(-) diff --git a/.github/workflows/buildwheel.yml b/.github/workflows/buildwheel.yml index 49ca28d0..7c8721ab 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 @@ -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,7 +179,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 main # Need to disable flint version check to build against main - run: pip install --config-settings=setup-args="-Dflint_version_check=false" . @@ -193,12 +193,23 @@ 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 -r requirements-dev.txt + - run: bin/coverage_setuptools.sh + + # Test that we can make a coverage build and report coverage + test_coverage_build: + name: Test coverage meson build + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '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/coverage.sh b/bin/coverage.sh index f73720af..6eeefec9 100755 --- a/bin/coverage.sh +++ b/bin/coverage.sh @@ -19,8 +19,8 @@ RC="--rcfile=.coveragerc.meson" # See https://github.com/cython/cython/issues/6658 # Needed for Python 3.13 only -#pip uninstall cython -#pip install git+https://github.com/cython/cython.git@fdbca99 +pip uninstall cython +pip install git+https://github.com/cython/cython.git@fdbca99 meson setup build -Dcoverage=true spin run -- coverage run $RC -m flint.test $@ diff --git a/bin/coverage_setuptools.sh b/bin/coverage_setuptools.sh index 10ec4a6f..c65eccee 100755 --- a/bin/coverage_setuptools.sh +++ b/bin/coverage_setuptools.sh @@ -1,13 +1,15 @@ #!/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 cython -#pip install git+https://github.com/cython/cython.git@fdbca99 +pip uninstall cython +pip install git+https://github.com/cython/cython.git@fdbca99 touch src/*/*/*.pyx PYTHON_FLINT_COVERAGE=1 python setup.py build_ext --inplace From 342a9d53bfedbf52c7f335f493a658fbb1ca2232 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Fri, 7 Feb 2025 23:51:05 +0000 Subject: [PATCH 03/10] Fix CI job name --- .github/workflows/buildwheel.yml | 2 +- coverage_plugin.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/buildwheel.yml b/.github/workflows/buildwheel.yml index 7c8721ab..cce31449 100644 --- a/.github/workflows/buildwheel.yml +++ b/.github/workflows/buildwheel.yml @@ -186,7 +186,7 @@ jobs: - 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: 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 From c1b2b2d51cdc41c23a82a9f726c781df874b919a Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Fri, 7 Feb 2025 23:53:11 +0000 Subject: [PATCH 04/10] Use -y to force uninstall Cython in CI --- bin/coverage.sh | 2 +- bin/coverage_setuptools.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/coverage.sh b/bin/coverage.sh index 6eeefec9..a08a9aa2 100755 --- a/bin/coverage.sh +++ b/bin/coverage.sh @@ -19,7 +19,7 @@ RC="--rcfile=.coveragerc.meson" # See https://github.com/cython/cython/issues/6658 # Needed for Python 3.13 only -pip uninstall cython +pip uninstall -y cython pip install git+https://github.com/cython/cython.git@fdbca99 meson setup build -Dcoverage=true diff --git a/bin/coverage_setuptools.sh b/bin/coverage_setuptools.sh index c65eccee..01c67034 100755 --- a/bin/coverage_setuptools.sh +++ b/bin/coverage_setuptools.sh @@ -8,7 +8,7 @@ RC="--rcfile=.coveragerc.setuptools" # See https://github.com/cython/cython/issues/6658 # Needed for Python 3.13 only -pip uninstall cython +pip uninstall -y cython pip install git+https://github.com/cython/cython.git@fdbca99 touch src/*/*/*.pyx From 6cad4d909ee13a5fb3374ff96dc2d8062b535cbd Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Sat, 8 Feb 2025 00:02:35 +0000 Subject: [PATCH 05/10] test: Install setuptools in coverage job --- bin/coverage_setuptools.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/coverage_setuptools.sh b/bin/coverage_setuptools.sh index 01c67034..dd0cd786 100755 --- a/bin/coverage_setuptools.sh +++ b/bin/coverage_setuptools.sh @@ -10,6 +10,7 @@ RC="--rcfile=.coveragerc.setuptools" # 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 From bdba14e708747569e745c7cf6c8338d1be345e83 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Sat, 8 Feb 2025 00:17:31 +0000 Subject: [PATCH 06/10] maint: bump minimum Cython version to 3.0.11 --- .github/workflows/buildwheel.yml | 2 +- meson.build | 2 +- pyproject.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/buildwheel.yml b/.github/workflows/buildwheel.yml index cce31449..0ce9e122 100644 --- a/.github/workflows/buildwheel.yml +++ b/.github/workflows/buildwheel.yml @@ -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 diff --git a/meson.build b/meson.build index 6417ea4a..500cf37e 100644 --- a/meson.build +++ b/meson.build @@ -8,7 +8,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] From adeb76115916acf6c8889ad83f9c2ae4d4b660da Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Sat, 8 Feb 2025 13:05:30 +0000 Subject: [PATCH 07/10] Add compat macro for gr_divnonunique in FLINT<3.1 --- src/flint/flintlib/types/gr.pxd | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 From 7b112e931c8260864af5b5f94bbae0482680ccfd Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Sat, 8 Feb 2025 13:30:08 +0000 Subject: [PATCH 08/10] Fix gr acb doctest for FLINT<3.1 --- src/flint/types/_gr.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) """ From 0be949b54b710f624af3b2655ba07c93e9efe367 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Sat, 8 Feb 2025 14:34:46 +0000 Subject: [PATCH 09/10] Use Pthon 3.12 for meson coverage job --- .github/workflows/buildwheel.yml | 4 ++-- bin/coverage.sh | 16 ++++++---------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/.github/workflows/buildwheel.yml b/.github/workflows/buildwheel.yml index 0ce9e122..40a66e50 100644 --- a/.github/workflows/buildwheel.yml +++ b/.github/workflows/buildwheel.yml @@ -200,14 +200,14 @@ jobs: - run: bin/coverage_setuptools.sh # Test that we can make a coverage build and report coverage - test_coverage_build: + 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.13' + python-version: '3.12' # does not work with 3.13 - run: sudo apt-get update - run: sudo apt-get install libflint-dev - run: pip install -r requirements-dev.txt diff --git a/bin/coverage.sh b/bin/coverage.sh index a08a9aa2..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: # @@ -18,9 +10,13 @@ set -o errexit RC="--rcfile=.coveragerc.meson" # See https://github.com/cython/cython/issues/6658 -# Needed for Python 3.13 only +# 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 git+https://github.com/cython/cython.git@fdbca99 +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 $RC -m flint.test $@ From 64df27dd70abba2948a5a7b8aea1c0ceab4a40dc Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Sat, 8 Feb 2025 16:12:26 +0000 Subject: [PATCH 10/10] Set minimum meson version to 1.1 --- meson.build | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 500cf37e..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