Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
2 changes: 2 additions & 0 deletions .coveragerc.setuptools
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[run]
plugins = Cython.Coverage
41 changes: 26 additions & 15 deletions .github/workflows/buildwheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 .
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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

Expand All @@ -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
Expand All @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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 .
Expand Down
1 change: 1 addition & 0 deletions bin/activate
Original file line number Diff line number Diff line change
@@ -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
25 changes: 14 additions & 11 deletions bin/coverage.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
#!/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:
#
# bin/coverage.sh -qt
#
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
19 changes: 19 additions & 0 deletions bin/coverage_setuptools.sh
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions coverage_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 7 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
8 changes: 7 additions & 1 deletion src/flint/flintlib/types/gr.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/flint/types/_gr.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
"""
Expand Down
Loading