Skip to content

Commit 45ea643

Browse files
Merge pull request #196 from oscarbenjamin/pr_freethreaded
Drop Python 3.9 and test free-threaded build
2 parents 630e20c + a7286e8 commit 45ea643

File tree

3 files changed

+177
-49
lines changed

3 files changed

+177
-49
lines changed

.github/workflows/buildwheel.yml

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ jobs:
107107
fail-fast: false
108108
matrix:
109109
os: [ubuntu-20.04, windows-2019, macos-13, macos-14]
110-
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13-dev']
110+
# This list to be kept in sync with cibuildwheel config
111+
# and python-requires in pyproject.toml.
112+
python-version: ['3.10', '3.11', '3.12', '3.13-dev']
111113

112114
steps:
113115
- uses: actions/setup-python@v5
@@ -209,6 +211,37 @@ jobs:
209211
- run: pip install -r requirements-dev.txt
210212
- run: bin/coverage.sh
211213

214+
# On new enough Ubuntu we can build against the system deb.
215+
test_freethreaded:
216+
name: Free-threaded ${{ matrix.python-version }} on ${{ matrix.os }}
217+
runs-on: ${{ matrix.os }}
218+
strategy:
219+
fail-fast: false
220+
matrix:
221+
os: [ubuntu-24.04]
222+
python-version: ['3.13-dev']
223+
steps:
224+
- uses: actions/checkout@v4
225+
# Can't use actions/setup-python
226+
# https://github.com/actions/setup-python/issues/771
227+
# deadsnakes only works for Ubuntu...
228+
- uses: deadsnakes/action@v3.1.0
229+
with:
230+
python-version: ${{ matrix.python-version }}
231+
nogil: true
232+
- run: |
233+
python --version --version
234+
which python
235+
python -c "import sysconfig; print(sysconfig.get_config_var('Py_GIL_DISABLED'))"
236+
python -c "import sys; print(sys._is_gil_enabled())"
237+
- run: sudo apt-get update
238+
- run: sudo apt-get install libflint-dev
239+
# Need Cython master until 3.1 is released
240+
- run: pip install git+https://github.com/cython/cython.git@master
241+
- run: pip install -r requirements-dev.txt
242+
- run: pip install --no-build-isolation .
243+
- run: python -m flint.test --verbose
244+
212245
# Run SymPy test suite against python-flint master
213246
test_sympy:
214247
name: Test SymPy ${{ matrix.sympy-version }}

README.md

Lines changed: 135 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ Author: Fredrik Johansson <fredrik.johansson@gmail.com>
1818
Installation
1919
------------
2020

21-
Currently python-flint supports CPython versions 3.9-3.12. For Windows (x86-64)
22-
or OSX (x86-64 or arm64) or Linux (x86-64 `manylinux_2_17`) there are CPython
23-
binary wheels for python-flint on PyPI. For these platforms python-flint can be
24-
installed simply with `pip`
21+
Currently python-flint supports CPython versions 3.10-3.13. For Windows
22+
(x86-64) or OSX (x86-64 or arm64) or Linux (x86-64 `manylinux_2_17`) there are
23+
CPython binary wheels for python-flint on PyPI. For these platforms
24+
python-flint can be installed simply with `pip`
2525

2626
pip install python-flint
2727

@@ -128,52 +128,136 @@ To do
128128
* Improved printing and string input/output
129129
* IPython hooks (TeX pretty-printing etc.)
130130

131+
Compatibility table
132+
-------------------
133+
134+
Generally each release of python-flint will be compatible with a range of
135+
Python versions as described in [SPEC
136+
0](https://scientific-python.org/specs/spec-0000/). Since python-flint 0.5.0
137+
the minimum supported Flint version is `3.0` and each release of python-flint
138+
supports all versions of Flint `>=3.0` available at the time of release.
139+
140+
Compatible versions (note that 0.7.0 is not yet released):
141+
142+
| python-flint | Release date | CPython | FLINT | Cython |
143+
|--------------|--------------|-------------|------------|------------|
144+
| `0.7.0` | Not yet | `3.10-3.13` | `3.0-3.2?` | `3.0-3.1?` |
145+
| `0.6.0` | 1st Feb 2024 | `3.9-3.12` | `3.0` only | `3.0` only |
146+
147+
As of python-flint 0.7.0, CPython 3.13 free-threaded builds are tested in CI
148+
but wheels are not provided on PyPI. There are no known issues related to using
149+
python-flint in a [PEP 703](https://peps.python.org/pep-0703/) free-threaded
150+
build but it is likely that mutating objects from multiple threads is not safe.
151+
152+
Binary wheels are not yet provided for Linux aarch64
153+
([gh-105](https://github.com/flintlib/python-flint/issues/105)) or for Windows
154+
on ARM but may be added when CI runners for Linux/Windows are available.
155+
131156
CHANGELOG
132157
-------------
133158

134-
Next release:
135-
136-
- [gh-172](https://github.com/flintlib/python-flint/pull/161)
137-
Add `fmpz_is_square`.
159+
Next release (0.7.0)...
160+
161+
Contributors (0.7.0):
162+
163+
- Jake Moss (JM)
164+
- Giacomo Pope (GP)
165+
- Joris Roos (JR)
166+
- Edgar Costa (EC)
167+
- Oscar Benjamin (OB)
168+
169+
Highlights (0.7.0):
170+
171+
- [gh-97](https://github.com/flintlib/python-flint/pull/97),
172+
[gh-182](https://github.com/flintlib/python-flint/pull/180):
173+
Add `fq_default` and `fq_default_poly` for finite fields and
174+
univariate polynomials over finite fields. (GP)
175+
- [gh-132](https://github.com/flintlib/python-flint/pull/132),
176+
[gh-164](https://github.com/flintlib/python-flint/pull/164),
177+
[gh-190](https://github.com/flintlib/python-flint/pull/190),
178+
[gh-192](https://github.com/flintlib/python-flint/pull/192):
179+
Add `fmpz_mpoly`, `fmpq_mpoly`, `nmod_poly` and `fmpz_mod_poly`
180+
types for multivariate polynomials with integer, rational or
181+
integers mod n coefficients. (JM)
182+
- [gh-142](https://github.com/flintlib/python-flint/pull/142)
183+
Add `acb_theta` module for the numerical evaluation of [theta
184+
functions](https://flintlib.org/doc/acb_theta.html) (only
185+
available for `Flint >= 3.1`). (EC)
186+
- [gh-129](https://github.com/flintlib/python-flint/pull/129)
187+
Use meson/meson-python instead of setuptools as the build system
188+
for parallel builds and better detection of build and dependency
189+
requirements. (OB)
190+
191+
Compatibility break (0.7.0):
192+
193+
- [gh-189](https://github.com/flintlib/python-flint/pull/189)
194+
As of python-flint 0.7.0 `fmpq_poly.factor()` now returns
195+
primitive rather than monic factors i.e. `2*x + 1` rather than
196+
`x + 1/2`. This ensures consistency between all poly types
197+
including between `fmpq_poly` and `fmpq_mpoly`. (OB)
198+
199+
Other changes (0.7.0):
200+
201+
- [gh-189](https://github.com/flintlib/python-flint/pull/189)
202+
All scalar and poly types now have `sqrt`. All poly types now
203+
have `factor_squarefree` and `leading_coefficient` methods.
204+
Exception types raised in a number of places were changed to
205+
`DomainError` for better consistency.
206+
- [gh-196](https://github.com/flintlib/python-flint/pull/196)
207+
Supported Python versions are 3.10-3.13 (3.9 dropped). CI
208+
Testing added for 3.13 free-threaded CPython.
209+
- [gh-194](https://github.com/flintlib/python-flint/pull/194)
210+
Add version checking for build requirements. (OB)
211+
- [gh-180](https://github.com/flintlib/python-flint/pull/180)
212+
Add `equal_trunc`, `add_trunc`, `sub_trunc`, `mul_low`,
213+
`mul_mod` and `pow_trunc` methods to `fmpz_mod_poly`. (GP)
214+
- [gh-177](https://github.com/flintlib/python-flint/pull/177)
215+
Remove old Py2 code for compatibility with Cython 3.1. (OB)
216+
- [gh-176](https://github.com/flintlib/python-flint/pull/176)
217+
Fix the error messages from `fmpq` constructor. (OB)
218+
- [gh-174](https://github.com/flintlib/python-flint/pull/174)
219+
Add `pow_mod` and `compose_mod` methods to `nmod_poly` and
220+
`fmpz_mod_poly`. Also add some missing methods to `nmod_poly`
221+
that other poly types already have. (GP)
222+
- [gh-172](https://github.com/flintlib/python-flint/pull/172)
223+
Add `fmpz_is_square`. (JR)
224+
- [gh-168](https://github.com/flintlib/python-flint/pull/168)
225+
Make comparisons consistent between different types. Add
226+
`is_one` and `is_zero` for all poly types. (OB)
138227
- [gh-161](https://github.com/flintlib/python-flint/pull/161)
139-
Add `acb.lerch_phi` to compute the Lerch transcendent.
140-
- [gh-132](https://github.com/flintlib/python-flint/pull/132)
141-
Add `fmpz_mpoly` and `fmpq_mpoly` types for multivariate polynomials with
142-
integer or rational coefficients.
228+
Add `acb.lerch_phi` to compute the Lerch transcendent. (OB)
143229
- [gh-160](https://github.com/flintlib/python-flint/pull/160)
144-
Add `bits` to `arb` and `acb`, add `log_base` to `arb`.
230+
Add `bits` to `arb` and `acb`, add `log_base` to `arb`. (JR)
145231
- [gh-149](https://github.com/flintlib/python-flint/pull/149)
146-
Bump Flint version to 3.1.3-p1 (Flint 3.0.0 - 3.1.3-p1 is supported but the
147-
wheels are built with 3.1.3-p1).
232+
Bump Flint version to 3.1.3-p1 (Flint 3.0.0 - 3.1.3-p1 is
233+
supported but the wheels are built with 3.1.3-p1). (OB)
148234
- [gh-148](https://github.com/flintlib/python-flint/pull/148)
149-
Remove debug symbols to make smaller Linux binaries.
235+
Remove debug symbols to make smaller Linux binaries. (OB)
150236
- [gh-144](https://github.com/flintlib/python-flint/pull/144)
151-
Add `rel_one_accuracy_bits` to `arb` and `acb`.
152-
- [gh-142](https://github.com/flintlib/python-flint/pull/142)
153-
Add `acb_theta` module for the numerical evaluation of [theta
154-
functions](https://flintlib.org/doc/acb_theta.html) (only available for
155-
`Flint >= 3.1`).
237+
Add `rel_one_accuracy_bits` to `arb` and `acb`. (EC)
156238
- [gh-137](https://github.com/flintlib/python-flint/pull/137)
157-
Add `erfinv` and `erfcinv` for `arb`.
158-
- [gh-129](https://github.com/flintlib/python-flint/pull/129)
159-
Use meson-python instead of setuptools as the build backend.
239+
Add `erfinv` and `erfcinv` for `arb`. (JR)
240+
- [gh-119](https://github.com/flintlib/python-flint/pull/119)
241+
Add compatibility with Flint 3.1. (OB)
160242

161243
0.6.0
162244

163245
- [gh-112](https://github.com/flintlib/python-flint/issues/112),
164246
[gh-111](https://github.com/flintlib/python-flint/issues/111),
165247
[gh-110](https://github.com/flintlib/python-flint/issues/110),
166248
[gh-108](https://github.com/flintlib/python-flint/issues/108):
167-
Add pyproject.toml and build dependencies. This means that python-flint can
168-
be built from source without `--no-build-isolation`.
249+
Add pyproject.toml and build dependencies. This means that
250+
python-flint can be built from source without
251+
`--no-build-isolation`.
169252
- [gh-109](https://github.com/flintlib/python-flint/issues/109):
170-
Use exact division for non-field domains. Now `fmpz(6)/fmpz(3)` returns an
171-
exact result `fmpz(2)` or raises an error if an exact result is not possible.
172-
Similar changes for `fmpz_poly/fmpz`, `fmpz_mat/fmpz`, and for polynomial
173-
division with `fmpz_poly`, `fmpq_poly`, `nmod_poly` and `fmpz_mod_poly`.
253+
Use exact division for non-field domains. Now `fmpz(6)/fmpz(3)`
254+
returns an exact result `fmpz(2)` or raises an error if an exact
255+
result is not possible. Similar changes for `fmpz_poly/fmpz`,
256+
`fmpz_mat/fmpz`, and for polynomial division with `fmpz_poly`,
257+
`fmpq_poly`, `nmod_poly` and `fmpz_mod_poly`.
174258
- [gh-106](https://github.com/flintlib/python-flint/issues/106):
175-
Add `fmpz_mod_mat` for matrices of integers mod `n` where `n` is larger than
176-
word sized.
259+
Add `fmpz_mod_mat` for matrices of integers mod `n` where `n` is
260+
larger than word sized.
177261
- [gh-104](https://github.com/flintlib/python-flint/issues/104):
178262
Bump Flint from 3.0.0 to 3.0.1
179263

@@ -186,7 +270,8 @@ Important compatibility changes:
186270
[gh-98](https://github.com/flintlib/python-flint/issues/98):
187271
Switch from Flint 2.9 to Flint 3.
188272
- [gh-100](https://github.com/flintlib/python-flint/issues/100):
189-
Supports Python 3.12 by using setuptools instead of numpy.distutils.
273+
Supports Python 3.12 by using setuptools instead of
274+
numpy.distutils.
190275

191276
New features:
192277

@@ -200,8 +285,8 @@ New features:
200285
Bug fixes:
201286

202287
- [gh-93](https://github.com/flintlib/python-flint/issues/93):
203-
Fixes a bug with `pow(int, int, fmpz)` which previously gave incorrect
204-
results.
288+
Fixes a bug with `pow(int, int, fmpz)` which previously gave
289+
incorrect results.
205290
- [gh-78](https://github.com/flintlib/python-flint/issues/78),
206291
[gh-79](https://github.com/flintlib/python-flint/issues/79):
207292
minor fixes for the `nmod` type.
@@ -214,11 +299,12 @@ Bug fixes:
214299
submodules
215300
- [gh-72](https://github.com/flintlib/python-flint/issues/72):
216301
The roots method of `arb_poly` is not supported. Use either the
217-
`complex_roots` method or `acb_roots(p).roots()` to get the old behaviour of
218-
returning the complex roots. The `roots` method on `fmpz_poly` and
219-
`fmpq_poly` now return integer and rational roots respectively. To access
220-
complex roots on these types, use the `complex_roots` method. For `acb_poly`,
221-
both `roots` and `complex_roots` behave the same
302+
`complex_roots` method or `acb_roots(p).roots()` to get the old
303+
behaviour of returning the complex roots. The `roots` method on
304+
`fmpz_poly` and `fmpq_poly` now return integer and rational
305+
roots respectively. To access complex roots on these types, use
306+
the `complex_roots` method. For `acb_poly`, both `roots` and
307+
`complex_roots` behave the same
222308
- [gh-71](https://github.com/flintlib/python-flint/issues/71):
223309
Include files in sdist and fix issue
224310
[gh-70](https://github.com/flintlib/python-flint/issues/70)
@@ -228,10 +314,11 @@ Bug fixes:
228314
0.4.3
229315

230316
- [gh-63](https://github.com/flintlib/python-flint/issues/63):
231-
The `roots` method of `arb_poly`, and `nmod_poly` is no longer supported. Use
232-
`acb_roots(p).roots()` to get the old behaviour of returning the roots as
233-
`acb`. Note that the `roots` method of `fmpz_poly` and `fmpq_poly` currently
234-
returns the complex roots of the polynomial.
317+
The `roots` method of `arb_poly`, and `nmod_poly` is no longer
318+
supported. Use `acb_roots(p).roots()` to get the old behaviour
319+
of returning the roots as `acb`. Note that the `roots` method of
320+
`fmpz_poly` and `fmpq_poly` currently returns the complex roots
321+
of the polynomial.
235322
- [gh-61](https://github.com/flintlib/python-flint/issues/61):
236323
Start refactoring job to introduce submodules into `python-flint`
237324

@@ -243,12 +330,14 @@ Bug fixes:
243330
0.4.1
244331

245332
- [gh-47](https://github.com/flintlib/python-flint/issues/47):
246-
Removes Linux wheels, updates instructions for building from source.
333+
Removes Linux wheels, updates instructions for building from
334+
source.
247335

248336
0.4.0
249337

250338
- [gh-45](https://github.com/flintlib/python-flint/issues/45):
251-
Adds wheels for Windows, OSX and manylinux but the Linux wheels are broken.
339+
Adds wheels for Windows, OSX and manylinux but the Linux wheels
340+
are broken.
252341

253342
License
254343
------------

pyproject.toml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
name = "python-flint"
33
description = "Bindings for FLINT"
44
version = "0.7.0a4"
5-
requires-python = ">= 3.9"
5+
# This needs to be in sync with README, cibuildwheel and CI config.
6+
requires-python = ">= 3.10"
67
urls = {Homepage = "https://github.com/flintlib/python-flint"}
78
authors = [
89
{name = "Fredrik Johansson", email = "fredrik.johansson@gmail.com"},
@@ -57,8 +58,13 @@ package = "flint"
5758
[tool.cibuildwheel]
5859
# requires-python needs to keep in sync with this and also the list of Python
5960
# versions the wheels are tested against in CI.
60-
build = "cp39-* cp310-* cp311-* cp312-* cp313-*"
61+
build = "cp310-* cp311-* cp312-* cp313-*"
6162
skip = "*-win32 *-manylinux_i686 *-musllinux_*"
63+
64+
# This is needed for free-threaded wheels:
65+
# build = "cp313t-*"
66+
# free-threaded-support = true
67+
6268
manylinux-x86_64-image = "manylinux2014"
6369
manylinux-i686-image = "manylinux2014"
6470
test-command = "python -c \"import flint; print(str(flint.fmpz(2)))\""

0 commit comments

Comments
 (0)