Skip to content

Commit 8f7ae8f

Browse files
authored
Merge branch 'master' into improve_powmod_and_compose
2 parents 99b91fb + 1178e20 commit 8f7ae8f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+3935
-690
lines changed

.cirrus.yml renamed to .cirrus.yml.backup

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,12 @@ cirrus_wheels_macos_arm64_task:
99
env:
1010
PATH: /opt/homebrew/opt/[email protected]/bin:$PATH
1111
CIBW_ARCHS_MACOS: arm64
12+
CIBW_TEST_COMMAND: "python -m flint.test"
1213
install_pre_requirements_script:
13-
- brew install [email protected]
14-
- ln -s python3 /opt/homebrew/opt/[email protected]/bin/python
15-
- which python
16-
- python --version
17-
install_cibuildwheel_script:
18-
- python -m pip install cibuildwheel==2.16.2
14+
- python3 -m venv venv
15+
- venv/bin/pip install --upgrade pip
16+
- venv/bin/pip install cibuildwheel==2.16.2
1917
run_cibuildwheel_script:
20-
- bin/cibw.sh
18+
- venv/bin/cibuildwheel --platform macos
2119
wheels_artifacts:
2220
path: "wheelhouse/*"

.github/workflows/buildwheel.yml

Lines changed: 69 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ jobs:
1010
strategy:
1111
fail-fast: false
1212
matrix:
13-
os: [ubuntu-20.04, windows-2019, macos-12]
13+
os: [ubuntu-20.04, windows-2019, macos-13, macos-14]
1414

1515
steps:
1616
- uses: actions/checkout@v4
1717

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

2222
- uses: msys2/setup-msys2@v2
2323
with:
@@ -31,8 +31,18 @@ jobs:
3131
path-type: inherit
3232
if: ${{ matrix.os == 'windows-2019' }}
3333

34+
# Install pkgconfig on Windows from choco rather than from msys and
35+
# avoid using the Strawberry one.
36+
- run: choco install -y --stoponfirstfailure --checksum 6004DF17818F5A6DBF19CB335CC92702 pkgconfiglite
37+
if: ${{ matrix.os == 'windows-2019' }}
38+
39+
# We have to set this here rather than in the cibuildwheel config
40+
# This is probably something to do with \ vs / in paths...
41+
- run: echo "PKG_CONFIG_PATH=${{ github.workspace }}/.local/lib/pkgconfig" >> $env:GITHUB_ENV
42+
if: ${{ matrix.os == 'windows-2019' }}
43+
3444
- name: Build wheels
35-
uses: pypa/cibuildwheel@v2.16.5
45+
uses: pypa/cibuildwheel@v2.19.2
3646
env:
3747
# override setting in pyproject.toml to use msys2 instead of msys64 bash
3848
CIBW_BEFORE_ALL_WINDOWS: msys2 -c bin/cibw_before_all_windows.sh
@@ -45,7 +55,7 @@ jobs:
4555

4656
build_sdist:
4757
name: Build sdist
48-
runs-on: ubuntu-20.04
58+
runs-on: ubuntu-22.04
4959

5060
steps:
5161
- uses: actions/checkout@v4
@@ -54,6 +64,11 @@ jobs:
5464
with:
5565
python-version: '3.12'
5666

67+
- run: sudo apt-get update
68+
- run: sudo apt-get install libgmp-dev libmpfr-dev xz-utils ninja-build
69+
- run: curl -O -L https://www.flintlib.org/flint-3.1.0.tar.gz
70+
- run: tar -xzf flint-3.1.0.tar.gz
71+
- run: cd flint-3.1.0 && ./configure --disable-static && make -j4 && sudo make install
5772
- run: pip install build
5873
- run: python -m build --sdist
5974

@@ -91,7 +106,7 @@ jobs:
91106
strategy:
92107
fail-fast: false
93108
matrix:
94-
os: [ubuntu-20.04, windows-2019, macos-12]
109+
os: [ubuntu-20.04, windows-2019, macos-13, macos-14]
95110
python-version: ['3.9', '3.10', '3.11', '3.12']
96111

97112
steps:
@@ -105,36 +120,69 @@ jobs:
105120
- run: pip install --no-index --find-links wheelhouse python_flint
106121
- run: python -m flint.test --verbose
107122

108-
test_pip_vcs_sdist:
109-
name: pip install ${{ matrix.target }} on ${{ matrix.python-version }}
110-
runs-on: ubuntu-22.04
123+
# On new enough Ubuntu we can build against the system deb.
124+
test_pip_flint_deb:
125+
name: Build on ${{ matrix.os }}
126+
runs-on: ${{ matrix.os }}
111127
strategy:
112128
fail-fast: false
113129
matrix:
114-
python-version: ['3.11', '3.12', '3.13-dev']
115-
# '.' means install from python-flint git checkout
116-
# 'python-flint' means install from PyPI sdist
117-
target: ['.', 'python-flint']
130+
os: [ubuntu-24.04]
118131
steps:
119132
- uses: actions/checkout@v4
120133
- uses: actions/setup-python@v5
121134
with:
122-
python-version: ${{ matrix.python-version }}
123-
- run: bin/pip_install_ubuntu.sh ${{ matrix.target }}
135+
python-version: '3.12'
136+
- run: sudo apt-get update
137+
- run: sudo apt-get install libflint-dev
138+
- run: pip install .
124139
- run: python -m flint.test --verbose
125140

141+
# For older Ubuntu we have to build Flint >= 3.0.0
126142
test_flint_versions:
127-
name: Test flint ${{ matrix.flinttag }}
143+
name: Test flint ${{ matrix.flint-tag }}
128144
runs-on: ubuntu-22.04
129145
strategy:
130146
fail-fast: false
131147
matrix:
132-
# minimum supported version and latest git
133-
flinttag: ['v3.0.0', 'main']
148+
# Supported versions and latest git
149+
flint-tag: ['v3.0.0', 'v3.0.1', 'v3.1.0', 'v3.1.1', 'v3.1.2', 'main']
134150
steps:
135-
- uses: actions/checkout@v3
136-
- uses: actions/setup-python@v4
151+
- uses: actions/checkout@v4
152+
- uses: actions/setup-python@v5
137153
with:
138-
python-version: 3.12
139-
- run: bin/pip_install_ubuntu.sh . ${{ matrix.flinttag }}
154+
python-version: '3.12'
155+
- run: bin/install_flint_ubuntu.sh ${{ matrix.flint-tag }}
156+
- run: pip install .
140157
- run: python -m flint.test --verbose
158+
159+
# Deploy wheels and sdist to PyPI
160+
161+
pypi_release:
162+
name: Publish to PyPI
163+
needs: [build_wheels, build_sdist]
164+
# Run only when a tag is pushed to the flintlib/python-flint repo
165+
if: "github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && github.repository_owner == 'flintlib'"
166+
environment:
167+
name: pypi
168+
url: https://pypi.org/p/sympy
169+
permissions:
170+
id-token: write
171+
runs-on: ubuntu-latest
172+
173+
steps:
174+
# Downloads all artifacts
175+
- name: Download release artifacts
176+
uses: actions/download-artifact@v4
177+
with:
178+
path: wheelhouse
179+
merge-multiple: true
180+
181+
- name: Copy the PyPI files into dist
182+
run: mkdir dist && cp wheelhouse/*.whl wheelhouse/*.tar.gz dist
183+
184+
- name: Publish package on PyPI
185+
# It is recommended to pin a commit hash here for security but it
186+
# should be kept up to date. Possibly all actions and dependencies used
187+
# by the build script should be pinned...
188+
uses: pypa/gh-action-pypi-publish@ec4db0b4ddc65acdf4bff5fa45ac92d78b56bdf0 # v1.9.0

.github/workflows/ci-sage.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,10 @@ jobs:
6464
sudo DEBIAN_FRONTEND=noninteractive apt-get update
6565
sudo DEBIAN_FRONTEND=noninteractive apt-get install $DIST_PREREQ
6666
if: env.DIST_PREREQ != ''
67-
- uses: actions/setup-python@v5
68-
with:
69-
python-version: '3.10'
70-
- run: pip install build
7167
- name: Run make dist, prepare upstream artifact
7268
run: |
73-
(cd build/pkgs/${{ env.SPKG }}/src && python -m build --sdist) \
74-
&& mkdir -p upstream && cp build/pkgs/${{ env.SPKG }}/src/dist/*.tar.gz upstream/${{ env.SPKG }}-git.tar.gz \
69+
(cd build/pkgs/${{ env.SPKG }}/src && git archive --format=tar.gz --prefix=${{ env.SPKG }}-git/ HEAD > ${{ env.SPKG }}-git.tar.gz) \
70+
&& mkdir -p upstream && cp build/pkgs/${{ env.SPKG }}/src/*.tar.gz upstream/${{ env.SPKG }}-git.tar.gz \
7571
&& echo "sage-package create ${{ env.SPKG }} --version git --tarball ${{ env.SPKG }}-git.tar.gz --type=standard" > upstream/update-pkgs.sh \
7672
&& if [ -n "${{ env.REMOVE_PATCHES }}" ]; then echo "(cd ../build/pkgs/${{ env.SPKG }}/patches && rm -f ${{ env.REMOVE_PATCHES }}; :)" >> upstream/update-pkgs.sh; fi \
7773
&& ls -l upstream/
@@ -87,7 +83,7 @@ jobs:
8783
targets: SAGE_CHECK=no SAGE_CHECK_flint=warn SAGE_CHECK_python_flint=yes python_flint
8884
# Standard setting: Test the current beta release of Sage:
8985
sage_repo: sagemath/sage
90-
sage_ref: refs/pull/37224/head
86+
sage_ref: refs/pull/38340/head
9187
#sage_ref: develop
9288
upstream_artifact: upstream
9389
# Docker targets (stages) to tag
@@ -106,7 +102,7 @@ jobs:
106102
targets: SAGE_CHECK=no SAGE_CHECK_flint=warn SAGE_CHECK_python_flint=yes python_flint
107103
# Standard setting: Test the current beta release of Sage:
108104
sage_repo: sagemath/sage
109-
sage_ref: refs/pull/37224/head
105+
sage_ref: refs/pull/38340/head
110106
#sage_ref: develop
111107
upstream_artifact: upstream
112108
needs: [dist]

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
build/*
2+
build-install/*
23
dist/*
34
src/flint/**/*.c
45
src/flint/*.html
@@ -18,3 +19,4 @@ MANIFEST
1819
.python-version
1920
*.DS_Store
2021
.venv
22+
.hypothesis

README.md

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,20 @@ First install FLINT 3. Starting with python-flint 0.5.0 older versions of Flint
4040
such as 2.9 are not supported any more. Note that as of Flint 3 Arb no longer
4141
needs to be built separately as it is now merged into Flint.
4242

43-
See here for instructions on building FLINT:
43+
As of e.g. Ubuntu 24.04 a new enough version of FLINT (at least version 3) can
44+
be installed from the Ubuntu repos like
45+
46+
sudo apt-get install libflint-dev
47+
48+
For older distros the version in the repos is too old and a newer version of
49+
FLINT needs to be built. See here for instructions on building FLINT:
4450

4551
* http://flintlib.org/
4652

53+
A script that builds and installs FLINT on Ubuntu can be found here:
54+
55+
* https://github.com/flintlib/python-flint/blob/master/bin/install_flint_ubuntu.sh
56+
4757
The latest release of Python-FLINT can then be built from source and installed
4858
using:
4959

@@ -54,11 +64,6 @@ as follows:
5464

5565
pip install .
5666

57-
A script that builds and installs FLINT and python-flint that is tested on
58-
Ubuntu can be found in the git repo here:
59-
60-
* https://github.com/flintlib/python-flint/blob/master/bin/pip_install_ubuntu.sh
61-
6267
See the documentation for further notes on building and installing
6368
python-flint:
6469

@@ -126,6 +131,33 @@ To do
126131
CHANGELOG
127132
-------------
128133

134+
Next release:
135+
136+
- [gh-172](https://github.com/flintlib/python-flint/pull/161)
137+
Add `fmpz_is_square`.
138+
- [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.
143+
- [gh-160](https://github.com/flintlib/python-flint/pull/160)
144+
Add `bits` to `arb` and `acb`, add `log_base` to `arb`.
145+
- [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).
148+
- [gh-148](https://github.com/flintlib/python-flint/pull/148)
149+
Remove debug symbols to make smaller Linux binaries.
150+
- [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`).
156+
- [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.
160+
129161
0.6.0
130162

131163
- [gh-112](https://github.com/flintlib/python-flint/issues/112),

bin/activate

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
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 PYTHONPATH=$(pwd)/src

bin/build_dependencies_unix.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ else
257257
tar xf mpfr-$MPFRVER.tar.gz
258258
cd mpfr-$MPFRVER
259259
./configure --prefix=$PREFIX\
260+
--host=$HOST_ARG\
260261
--with-gmp=$PREFIX\
261262
--enable-shared=yes\
262263
--enable-static=no
@@ -281,10 +282,17 @@ curl -O -L https://github.com/flintlib/flint/releases/download/v$FLINTVER/flint-
281282
tar xf flint-$FLINTVER.tar.gz
282283
cd flint-$FLINTVER
283284
./bootstrap.sh
285+
# --host=$HOST_ARG\ # host is ignored
286+
# --enable-arch works on 3.1.3p1, not available on HEAD
284287
./configure --prefix=$PREFIX\
288+
--enable-arch=${HOST_ARG%%-*}\
289+
--disable-assembly\
290+
--disable-avx2\
291+
--disable-avx512\
285292
$FLINTARB_WITHGMP\
286293
--with-mpfr=$PREFIX\
287-
--disable-static
294+
--disable-static\
295+
--disable-debug
288296
make -j6
289297
make install
290298
cd ..

bin/build_variables.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ MPIRVER=3.0.0 # MPIR build no longer works (not clear where to download from)
2121
# These are the actual dependencies used (at least by default):
2222
GMPVER=6.3.0
2323
MPFRVER=4.1.0
24-
FLINTVER=3.0.1
24+
FLINTVER='3.1.3-p1'

bin/bump_version.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/env python
2+
3+
filenames_default = [
4+
"pyproject.toml",
5+
"src/flint/__init__.py",
6+
"doc/source/conf.py",
7+
"src/flint/test/test_all.py",
8+
]
9+
10+
def main(version2=None, *filenames):
11+
"""Bump version number in files.
12+
13+
$ bin/bump_version.py
14+
Current version: 0.1.0
15+
16+
$ bin/bump_version.py 0.1.0 0.1.1
17+
Set version 0.1.0 to 0.1.1 in:
18+
pyproject.toml
19+
src/flint/__init__.py
20+
doc/source/conf.py
21+
src/flint/test/test_all.py
22+
23+
"""
24+
with open("pyproject.toml", "r") as f:
25+
text = f.read()
26+
version1 = text.split("version = \"")[1].split("\"")[0]
27+
28+
if not version2:
29+
print(f"Current version: {version1}")
30+
return
31+
32+
if not filenames:
33+
filenames = filenames_default
34+
35+
print(f"Set version {version1} to {version2} in:")
36+
for filename in filenames:
37+
print(filename)
38+
with open(filename, "r") as f:
39+
text = f.read()
40+
with open(filename, "w") as f:
41+
f.write(text.replace(version1, version2))
42+
43+
if __name__ == "__main__":
44+
import sys
45+
main(*sys.argv[1:])

bin/cibw.sh

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)