Skip to content

Commit f44a589

Browse files
Merge pull request #260 from oscarbenjamin/pr_coverage_again
test: reenable setuptools coverage build
2 parents 292fa0d + 64df27d commit f44a589

11 files changed

+79
-31
lines changed

.coveragerc .coveragerc.meson

File renamed without changes.

.coveragerc.setuptools

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[run]
2+
plugins = Cython.Coverage

.github/workflows/buildwheel.yml

+26-15
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717

1818
- uses: actions/setup-python@v5
1919
with:
20-
python-version: '3.12'
20+
python-version: '3.13'
2121

2222
- uses: msys2/setup-msys2@v2
2323
with:
@@ -65,7 +65,7 @@ jobs:
6565

6666
- uses: actions/setup-python@v5
6767
with:
68-
python-version: '3.12'
68+
python-version: '3.13'
6969

7070
- run: bin/install_latest_flint_ubuntu.sh
7171
- run: pip install build
@@ -111,7 +111,7 @@ jobs:
111111
- uses: actions/checkout@v4
112112
- uses: actions/setup-python@v5
113113
with:
114-
python-version: '3.12'
114+
python-version: '3.13'
115115
- run: sudo apt-get update
116116
- run: sudo apt-get install libflint-dev
117117
- run: pip install .
@@ -124,7 +124,7 @@ jobs:
124124
- uses: actions/checkout@v4
125125
- uses: actions/setup-python@v5
126126
with:
127-
python-version: '3.12'
127+
python-version: '3.13'
128128
- run: bin/install_latest_flint_ubuntu.sh
129129
- run: pip install --upgrade pip
130130
- run: pip install -r requirements-dev.txt
@@ -139,7 +139,7 @@ jobs:
139139
- uses: actions/checkout@v4
140140
- uses: actions/setup-python@v5
141141
with:
142-
python-version: '3.12'
142+
python-version: '3.13'
143143
- run: sudo apt-get update
144144
- run: sudo apt-get install libflint-dev
145145
# The versions of cython and meson-python here should be kept in sync
@@ -149,7 +149,7 @@ jobs:
149149
# We don't need to specify ninja as a requirement in pyproject.toml
150150
# because without --no-build-isolation meson-python handles it
151151
# automatically in get_requirements_for_build_wheel().
152-
- run: 'pip install "cython==3.0" "meson-python==0.13" "ninja<1.11"'
152+
- run: 'pip install "cython==3.0.11" "meson-python==0.13" "ninja<1.11"'
153153
- run: pip install --no-build-isolation .
154154
- run: python -m flint.test --verbose
155155

@@ -166,7 +166,7 @@ jobs:
166166
- uses: actions/checkout@v4
167167
- uses: actions/setup-python@v5
168168
with:
169-
python-version: '3.12'
169+
python-version: '3.13'
170170
- run: bin/install_flint_ubuntu.sh ${{ matrix.flint-tag }}
171171
- run: pip install .
172172
- run: python -m flint.test --verbose
@@ -179,26 +179,37 @@ jobs:
179179
- uses: actions/checkout@v4
180180
- uses: actions/setup-python@v5
181181
with:
182-
python-version: '3.12'
182+
python-version: '3.13'
183183
- run: bin/install_flint_ubuntu.sh main
184184
# Need to disable flint version check to build against main
185185
- run: pip install --config-settings=setup-args="-Dflint_version_check=false" .
186186
- run: python -m flint.test --verbose
187187

188188
# Test that we can make a coverage build and report coverage
189-
test_coverage_build:
189+
test_coverage_build_setuptools:
190190
name: Test coverage setuptools build
191191
runs-on: ubuntu-24.04
192192
steps:
193193
- uses: actions/checkout@v4
194194
- uses: actions/setup-python@v5
195195
with:
196-
python-version: '3.12'
196+
python-version: '3.13'
197+
- run: sudo apt-get update
198+
- run: sudo apt-get install libflint-dev
199+
- run: pip install -r requirements-dev.txt
200+
- run: bin/coverage_setuptools.sh
201+
202+
# Test that we can make a coverage build and report coverage
203+
test_coverage_build_meson:
204+
name: Test coverage meson build
205+
runs-on: ubuntu-24.04
206+
steps:
207+
- uses: actions/checkout@v4
208+
- uses: actions/setup-python@v5
209+
with:
210+
python-version: '3.12' # does not work with 3.13
197211
- run: sudo apt-get update
198212
- run: sudo apt-get install libflint-dev
199-
# Need Cython's master branch until 3.1 is released because of:
200-
# https://github.com/cython/cython/pull/6341
201-
- run: pip install git+https://github.com/cython/cython.git@master
202213
- run: pip install -r requirements-dev.txt
203214
- run: bin/coverage.sh
204215

@@ -210,7 +221,7 @@ jobs:
210221
fail-fast: false
211222
matrix:
212223
os: [ubuntu-24.04]
213-
python-version: ['3.13-dev']
224+
python-version: ['3.13', '3.14-dev']
214225
steps:
215226
- uses: actions/checkout@v4
216227
# Can't use actions/setup-python
@@ -245,7 +256,7 @@ jobs:
245256
- uses: actions/checkout@v4
246257
- uses: actions/setup-python@v5
247258
with:
248-
python-version: '3.12'
259+
python-version: '3.13'
249260
- run: sudo apt-get update
250261
- run: sudo apt-get install libflint-dev
251262
- run: pip install .

bin/activate

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export C_INCLUDE_PATH=$(pwd)/.local/include
22
export LIBRARY_PATH=$(pwd)/.local/lib
33
export LD_LIBRARY_PATH=$(pwd)/.local/lib
4+
export PKG_CONFIG_PATH=$(pwd)/.local/lib/pkgconfig

bin/coverage.sh

+14-11
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
11
#!/bin/bash
22
#
3-
# This needs a patched Cython:
4-
#
5-
# pip install git+https://github.com/oscarbenjamin/cython.git@pr_relative_paths
6-
#
7-
# That patch has been submitted as a pull request:
8-
#
9-
# https://github.com/cython/cython/pull/6341
10-
#
113
# Arguments to this script are passed to python -m flint.test e.g. to skip
124
# doctests and run in quiet mode:
135
#
146
# bin/coverage.sh -qt
157
#
168
set -o errexit
179

10+
RC="--rcfile=.coveragerc.meson"
11+
12+
# See https://github.com/cython/cython/issues/6658
13+
# Needed for Python 3.13 only but the plugin does not work with 3.13 anyway...
14+
#pip uninstall -y cython
15+
#pip install git+https://github.com/cython/cython.git@fdbca99
16+
17+
pip uninstall -y cython
18+
pip install --pre cython # unpinned to pick up new releases in CI
19+
# pip install cython==3.1.0a1 # known working version for Python < 3.13
20+
1821
meson setup build -Dcoverage=true
19-
spin run -- coverage run -m flint.test $@
20-
coverage report -m --sort=cover
21-
coverage html
22+
spin run -- coverage run $RC -m flint.test $@
23+
coverage report $RC -m --sort=cover
24+
coverage html $RC

bin/coverage_setuptools.sh

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
RC="--rcfile=.coveragerc.setuptools"
6+
7+
# Comment out various lines below for speed if running multiple times.
8+
9+
# See https://github.com/cython/cython/issues/6658
10+
# Needed for Python 3.13 only
11+
pip uninstall -y cython
12+
pip install git+https://github.com/cython/cython.git@fdbca99
13+
pip install setuptools
14+
15+
touch src/*/*/*.pyx
16+
PYTHON_FLINT_COVERAGE=1 python setup.py build_ext --inplace
17+
PYTHONPATH=src coverage run $RC -m flint.test
18+
coverage report $RC -m --sort=cover
19+
coverage html $RC

coverage_plugin.py

+1
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ class CyFileTracer(FileTracer):
128128
"""File tracer for Cython files (.pyx,.pxd)."""
129129

130130
def __init__(self, srcpath):
131+
print(srcpath)
131132
assert (src_dir / srcpath).exists()
132133
self.srcpath = srcpath
133134

meson.build

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
project('python-flint', 'cython', 'c')
1+
project(
2+
'python-flint',
3+
'cython',
4+
'c',
5+
meson_version : '>=1.1',
6+
)
27
#
38
# The minimum versions are because we know that it will not work with earlier
49
# versions. The maximum versions are because python-flint was not tested
@@ -8,7 +13,7 @@ project('python-flint', 'cython', 'c')
813
#
914
flint_lower = '>=3.0'
1015
flint_upper = '<3.2'
11-
cython_lower = '>=3.0'
16+
cython_lower = '>=3.0.11'
1217
cython_upper = '<3.2'
1318

1419
py = import('python').find_installation(pure: false)

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ content-type = "text/markdown"
3636
# until we have actually witnessed a Cython 3.x release that does not break the
3737
# build we should keep the upper cap.
3838
#
39-
requires = ["meson-python>=0.13", "cython>=3.0,<3.1"]
39+
requires = ["meson-python>=0.13", "cython>=3.0.11,<3.1"]
4040
build-backend = "mesonpy"
4141

4242
[tool.cython-lint]

src/flint/flintlib/types/gr.pxd

+7-1
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,15 @@ from flint.flintlib.types.flint cimport (
88
cdef extern from *:
99
"""
1010
/*
11-
* The following functions were introduced in FLINT 3.2.0
11+
* The following functions were introduced in FLINT 3.1.0
1212
*/
13+
#if __FLINT_RELEASE < 30100
14+
#define gr_div_nonunique(res, x, y, ctx) GR_UNABLE
15+
#endif
1316
17+
/*
18+
* The following functions were introduced in FLINT 3.2.0
19+
*/
1420
#if __FLINT_RELEASE < 30200
1521
#define gr_min(res, x, y, ctx) GR_UNABLE
1622
#define gr_max(res, x, y, ctx) GR_UNABLE

src/flint/types/_gr.pyx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1708,7 +1708,7 @@ cdef class gr(flint_scalar):
17081708

17091709
>>> from flint.types._gr import gr_complex_acb_ctx
17101710
>>> acb = gr_complex_acb_ctx.new(53)
1711-
>>> x = acb("pi")
1711+
>>> x = acb("2")
17121712
>>> x.parent()
17131713
gr_complex_acb_ctx(53)
17141714
"""

0 commit comments

Comments
 (0)