Python bindings for Flint and Arb
Repo flintlib/python-flint, read from GitHub 20 min ago. flintlib has not joined Take My Repo.
flintlib/python-flint is a public repo on GitHub by flintlib. Python bindings for Flint and Arb. It declares the MIT license on GitHub. It is written mainly in Cython, has 162 stars and last changed on 2026-11-10. Nobody has reviewed it on Take My Repo yet, which says nothing about its quality. Read from GitHub on 2026-11-22.
In the maintainer's words. Shown from GitHub; Take My Repo does not keep a copy.
Python extension module wrapping FLINT (Fast Library for Number Theory) and Arb (arbitrary-precision ball arithmetic). Features:
Documentation: https://python-flint.readthedocs.io/en/latest/
Repository: https://github.com/flintlib/python-flint/
Author: Fredrik Johansson fredrik.johansson@gmail.com
Currently python-flint supports CPython versions 3.10-3.14 and 3.14t (free-threaded) and provides binaries on PyPI for the following platforms:
For these platforms python-flint can be installed simply with pip
pip install python-flint
Alternatively python-flint can be installed using conda
conda install -c conda-forge python-flint
For other platforms or architectures installation needs to build from source. First install FLINT 3.4 or newer. Note that as of Flint 3 Arb no longer needs to be built separately as it is now merged into Flint.
As of e.g. Ubuntu 26.04 a new enough version of FLINT (at least version 3.4) can be installed from the Ubuntu repos like
sudo apt-get install libflint-dev
For older distros the version in the repos is too old and a newer version of FLINT needs to be built. See here for instructions on building FLINT:
A script that builds and installs FLINT on Ubuntu can be found here:
The latest release of Python-FLINT can then be built from source and installed using:
pip install --no-binary python-flint python-flint
Python-FLINT can also be installed from a git checkout or a source archive as follows:
pip install .
See the documentation for further notes on building and installing python-flint:
Import Python-FLINT:
>>> from flint import *
Number-theoretic functions:
>>> fmpz(1000).partitions_p()
24061467864032622473692149727991
>>> fmpq.bernoulli(64)
-106783830147866529886385444979142647942017/510
Polynomial arithmetic:
>>> a = fmpz_poly([1,2,3]); b = fmpz_poly([2,3,4]); a.gcd(a * b)
3*x^2 + 2*x + 1
>>> a = fmpz_poly(list(range(10001))); b = fmpz_poly(list(range(10000))); a.gcd(a * b).degree()
10000
>>> x = fmpz_poly([0,1]); ((1-x**2)*(1+x**3)**3*(1+x+2*x)).factor()
(-1, [(3*x + 1, 1), (x + (-1), 1), (x^2 + (-1)*x + 1, 3), (x + 1, 4)])
Matrix arithmetic:
>>> fmpz_mat([[1,1],[1,0]]) ** 10
[89, 55]
[55, 34]
>>> fmpq_mat.hilbert(10,10).det()
1/46206893947914691316295628839036278726983680000000000
Numerical evaluation:
>>> showgood(lambda: (arb.pi() * arb(163).sqrt()).exp() - 640320**3 - 744, dps=25)
-7.499274028018143111206461e-13
>>> showgood(lambda: (arb.pi() * 10**100 + arb(1)/1000).sin(), dps=25)
0.0009999998333333416666664683
Numerical integration:
>>> ctx.dps = 30
>>> acb.integral(lambda x, _: (-x**2).exp(), -100, 100) ** 2
[3.141592653589793238462643383 +/- 3.11e-28]
ZZ(1) etc rather than fmpz_poly([1, 2]).Generally each release of python-flint will be compatible with a range of Python and FLINT versions. The supported range for each release is shown below.
Compatible versions:
| python-flint | Release date | CPython | FLINT | Cython |
|---|---|---|---|---|
0.10.0 |
Not released | 3.10-3.15 |
3.4-3.6 |
3.1-3.3 |
0.9.0 |
3rd Jul 2026 | 3.10-3.14 |
3.0-3.6 |
3.1-3.2 |
0.8.0 |
29th Aug 2025 | 3.11-3.14 |
3.0-3.3 |
3.1 only |
0.7.0 |
16th Mar 2025 | 3.11-3.13 |
3.0-3.2 |
3.0.11-3.1.0a1 |
0.6.0 |
1st Feb 2024 | 3.9-3.12 |
3.0 only |
3.0 only |
The requirement for Cython 3.1 is only for CPython's free-threaded build. Otherwise Cython 3.0 is fine. Cython 3.2 is required for a stable ABI build of python-flint.
As of python-flint 0.7.0, CPython 3.13 PEP 703 free-threaded (no-GIL) builds of python-flint are provided. In the the free-threaded build, mutating matrices or polynomials from multiple threads can lead to memory corruption. There are some other known issues with the free-threaded build so it should be considered experimental.
Contributors (0.10.0):
Changes (0.10.0):
str() (and so in repr(), which uses it unless
flint.ctx.pretty is False) of fmpz_mpoly, fmpq_mpoly,
fmpz_mod_mpoly and nmod_mpoly: the string returned by FLINT was
copied into a Python bytes object but never freed. (UKH)iarb and
ifmpz) after the classes they reference, so that the ty type checker
resolves them instead of treating them as Unknown. (IG)zpoly and zcontent methods to fmpq_mpoly, to get
the primitive integer polynomial and the fmpq content, which
form the internal representation of the fmpq_mpoly. Also add
support for building with Cython 3.3. (VM, OB)Contributors (0.9.0):
Changes (0.9.0):
mul_low and pow_trunc methods to fmpz_poly, fmpq_poly and
nmod_poly. (RO)nmod_poly and
fq_default_poly. Some tests are fixed so that they pass on
32-bit systems. (AK, OB)discriminant method to fmpz_poly, fmpq_poly and
nmod_poly. (RO)arb.neg() which caused it to return its input
without negating it. (DSM)fmpq.__float__ method so that float(fmpq) and complex(fmpq)
work. (OB)int to fmpz and back. (RO).arb values. (DSM)fq_default. (OB)fmpz_mat.lll() for empty matrices. (OB)unused_gens() for the zero polynomial. (OB)nmod.__hash__. (FH)fmpz_mod_mat_det() when building against FLINT 3.1 or newer. (OB)acb_theta_jet (JH, SS)Contributors (0.8.0):
Notes (0.8.0):
Changes (0.8.0):
truncate, left_shift and right_shift methods to
fmpz_poly, fmpq_poly, nmod_poly, acb_poly, arb_poly
to match other univariate polynomial types. (RO)fmpz, fmpq, nmod, fmpz_mod,
fq_default, fmpz_poly, fmpq_poly, nmod_poly,
fmpz_mod_poly, fq_default_poly, fmpz_mpoly, fmpq_mpoly,
nmod_mpoly, fmpz_mod_mpoly, fmpz_series and fmpq_series
(about half of the codebase). (OB)arb.repr which now returns a Python representation that
round trips. (OB)fmpq constructor now accepts fmpq numerator and denominator
as input. (OB).prec attribute to series types fmpz_series, fmpq_series,
arb_series and acb_series. (OB)fmpz_poly, fmpq_poly and
nmod_poly. Now all univariate and polynomial types have the
resultant method except for fq_default_poly. (RDB)Contributors (0.7.0):
Highlights (0.7.0):
fq_default and fq_default_poly for finite fields and
univariate polynomials over finite fields. This exposes all
of the different implementations of finite fields (fq_zech,
fq_nmod etc) via the fq_default interface. (GP)fmpz_mpoly, fmpq_mpoly, nmod_poly and fmpz_mod_poly
types for multivariate polynomials with integer, rational or
integers mod n coefficients. (JM)acb_theta module for the numerical evaluation of theta
functions (only
available for Flint >= 3.1). (EC)Compatibility break (0.7.0):
fmpq_poly.factor() now returns
primitive rather than monic factors i.e. 2*x + 1 rather than
x + 1/2. This ensures consistency between all poly types
including between fmpq_poly and fmpq_mpoly. (OB)Other changes (0.7.0):
is_zero, is_one and is_constant methods. All polynomial
types now consistently handle negative powers where possible.fmpz_mat.fflu for fraction-free LU decomposition of
an integer matrix.extraprec, extradps, workprec and workdps. (TH)fmpq.gcd() method.sqrt. All poly types now
have factor_squarefree and leading_coefficient methods.
Exception types raised in a number of places were changed to
DomainError for better consistency. (OB)equal_trunc, add_trunc, sub_trunc, mul_low,
mul_mod and pow_trunc methods to fmpz_mod_poly. (GP)fmpq constructor. (OB)pow_mod and compose_mod methods to nmod_poly and
fmpz_mod_poly. Also add some missing methods to nmod_poly
that other poly types already have. (GP)fmpz_is_square. (JR)is_one and is_zero for all poly types. (OB)acb.lerch_phi to compute the Lerch transcendent. (OB)bits to arb and acb, add log_base to arb. (JR)rel_one_accuracy_bits to arb and acb. (EC)erfinv and erfcinv for arb. (JR)--no-build-isolation.fmpz(6)/fmpz(3)
returns an exact result fmpz(2) or raises an error if an exact
result is not possible. Similar changes for fmpz_poly/fmpz,
fmpz_mat/fmpz, and for polynomial division with fmpz_poly,
fmpq_poly, nmod_poly and fmpz_mod_poly.fmpz_mod_mat for matrices of integers mod n where n is
larger than word sized.Important compatibility changes:
New features:
fmpz_mod_poly type for polynomials over fmpz_mod.fmpz_mod.fmpz_mod type for multi-precision integer mods.Bug fixes:
pow(int, int, fmpz) which previously gave
incorrect results.nmod type.python-flint into
submodulesarb_poly is not supported. Use either the
complex_roots method or acb_roots(p).roots() to get the old
behaviour of returning the complex roots. The roots method on
fmpz_poly and fmpq_poly now return integer and rational
roots respectively. To access complex roots on these types, use
the complex_roots method. For acb_poly, both roots and
complex_roots behave the samepython-flintroots method of arb_poly, and nmod_poly is no longer
supported. Use acb_roots(p).roots() to get the old behaviour
of returning the roots as acb. Note that the roots method of
fmpz_poly and fmpq_poly currently returns the complex roots
of the polynomial.python-flintPython-FLINT is licensed MIT. FLINT and Arb are LGPL v2.1+.
flintlib/python-flint is a public repo on GitHub by flintlib. Python bindings for Flint and Arb.
It declares the MIT license on GitHub.
Its maker tagged it for macOS, Windows and Linux, or as Docker or cross-platform. That is declared by the maker; Take My Repo has not tested it.
Open "Take it" on its page: Take My Repo writes an install plan for your machine and hands it to your AI agent (Claude Code, Codex or Cursor), which asks you before each step. Take My Repo has not tested it on any machine.
Its last change on GitHub was on 2026-11-10. GitHub counts 54 open issues and pull requests. Take My Repo does not judge from that whether it is maintained.
Nobody has reviewed it on Take My Repo yet, which says nothing about its quality.
Arb has been merged into FLINT -- use https://github.com/flintlib/flint/ instead
Calcium has been merged into FLINT -- use https://github.com/flintlib/flint/ instead
Antic has been merged into FLINT -- use https://github.com/flintlib/flint/ instead
This page is also available as structured data, with the same sources and dates.
/api/v1/resources/gh/flintlib/python-flintTake My Repo has not tested this on your machine. Requirements come from the project's own documentation.