Skip to content

Commit 99fa557

Browse files
Merge pull request #48 from oscarbenjamin/pr_pip_linux
Add tests for installing on Linux
2 parents bde3dbd + 15addd2 commit 99fa557

15 files changed

+300
-72
lines changed

.github/workflows/buildwheel.yml

+17-18
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ jobs:
6868
python-version: ['3.9', '3.10', '3.11']
6969

7070
steps:
71-
- uses: actions/checkout@v3
7271
- uses: actions/setup-python@v4
7372
with:
7473
python-version: ${{ matrix.python-version }}
@@ -77,26 +76,26 @@ jobs:
7776
name: artifact
7877
path: wheelhouse
7978
- run: pip install --find-links wheelhouse python_flint
80-
- run: python test/test.py
81-
82-
doctest_wheels:
83-
needs: build_wheels
84-
name: Doctests for ${{ matrix.python-version }} wheel on ${{ matrix.os }}
85-
runs-on: ${{ matrix.os }}
86-
strategy:
87-
fail-fast: false
88-
matrix:
89-
os: [ubuntu-20.04, windows-2019, macos-12]
90-
python-version: ['3.9', '3.10', '3.11']
79+
- run: python -m flint.test --verbose
9180

81+
test_pip_linux_vcs:
82+
name: Install from git checkout on Ubuntu
83+
runs-on: ubuntu-22.04
9284
steps:
9385
- uses: actions/checkout@v3
9486
- uses: actions/setup-python@v4
9587
with:
96-
python-version: ${{ matrix.python-version }}
97-
- uses: actions/download-artifact@v3
88+
python-version: 3.11
89+
- run: bin/pip_install_ubuntu.sh . # Install from checkout
90+
- run: python -m flint.test --verbose
91+
92+
test_pip_linux_pypi:
93+
name: Install from PyPI sdist on Ubuntu
94+
runs-on: ubuntu-22.04
95+
steps:
96+
- uses: actions/checkout@v3
97+
- uses: actions/setup-python@v4
9898
with:
99-
name: artifact
100-
path: wheelhouse
101-
- run: pip install --find-links wheelhouse python_flint
102-
- run: python test/dtest.py
99+
python-version: 3.11
100+
- run: bin/pip_install_ubuntu.sh python-flint # Install from PyPI sdist
101+
- run: python -m flint.test --verbose

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ install:
2828
- pip install .
2929

3030
script:
31-
- python test/test.py
31+
- python -m flint.test

README.md

+25-8
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,43 @@ Author: Fredrik Johansson <[email protected]>
1818
Installation
1919
------------
2020

21-
First install both FLINT (version 2.5 or later) and Arb (version 2.15 or later).
22-
See:
21+
On Windows (x86-64) or OSX (x86-64 or arm64) there are prebuilt wheels for
22+
python-flint 0.4.1 that can be installed from PyPI using pip
23+
24+
pip install python-flint
25+
26+
There is currently a problem with the Linux wheels and so for now Linux wheels
27+
are not available on PyPI. Instead for Linux first install both FLINT 2.9.0 and
28+
Arb 2.23. Note that as of python-flint 0.4.1 only these *exact* versions of
29+
FLINT and Arb will work. While some Linux distributions may provide FLINT and
30+
Arb it is unlikely that they will provide the exact versions required (e.g.
31+
for Ubuntu only Ubuntu 23.04 provides these versions at the time of writing).
32+
33+
See here for instructions on building FLINT and Arb:
2334

2435
* http://flintlib.org/
2536
* http://arblib.org/
2637

27-
The latest release of Python-FLINT can then be installed using:
38+
The latest release of Python-FLINT can then be built and installed using:
2839

29-
pip install python-flint
40+
pip install 'cython>=3' numpy wheel
41+
pip install --no-build-isolation python-flint
3042

31-
Python-FLINT can also be installed git checkout or a source archive
43+
Python-FLINT can also be installed from a git checkout or a source archive
3244
as follows:
3345

34-
pip install .
46+
pip install 'cython>=3' numpy wheel
47+
pip install --no-build-isolation .
48+
49+
A script that builds and installs FLINT, Arb and Python-FLINT that is tested on
50+
Ubuntu can be found in the git repo here:
51+
52+
* https://github.com/fredrik-johansson/python-flint/blob/master/bin/pip_install_ubuntu.sh
3553

3654
See the documentation for further notes on building and installing
3755
Python-FLINT:
3856

39-
https://fredrikj.net/python-flint/setup.html
57+
* https://fredrikj.net/python-flint/setup.html
4058

4159
Examples
4260
-------------------------------------
@@ -95,7 +113,6 @@ To do
95113
* Conversions to and from external types (numpy, sage, sympy, mpmath, gmpy)
96114
* Improved printing and string input/output
97115
* IPython hooks (TeX pretty-printing etc.)
98-
* Windows support
99116

100117
License
101118
------------

bin/build_mingw64_wheel.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ fi
4444
PYTHON=$PYTHONDIR/python
4545
VER="${PYTHONVER//./}"
4646

47-
WHEELNAME=python_flint-0.4.0-cp$VER-cp$VER-win_amd64.whl
47+
WHEELNAME=python_flint-0.4.1-cp$VER-cp$VER-win_amd64.whl
4848

4949
$PYTHON -c 'print("hello world")'
5050

@@ -90,7 +90,7 @@ wheel pack python_flint-*
9090
cd ..
9191

9292
# Make the wheel relocatable
93-
delvewheel repair dist/python_flint-0.4.0-cp$VER-cp$VER-win_amd64.whl \
93+
delvewheel repair dist/python_flint-0.4.1-cp$VER-cp$VER-win_amd64.whl \
9494
--add-path .local/bin:.local/lib/
9595

9696
# Make a virtual enironment to test the wheel

bin/cibw.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export CIBW_BEFORE_BUILD_WINDOWS='C:\\msys64\\usr\\bin\\bash bin/cibw_before_bui
2929
export CIBW_REPAIR_WHEEL_COMMAND_WINDOWS='bin\cibw_repair_wheel_command_windows.bat {dest_dir} {wheel}'
3030

3131
# export CIBW_TEST_COMMAND="python -c 'import flint; print(str(flint.fmpz(2)))'"
32-
export CIBW_TEST_COMMAND="python {project}/test/test.py && python {project}/test/dtest.py"
32+
export CIBW_TEST_COMMAND="python -m flint.test"
3333

3434
# cibuildwheel --platform linux
3535
# cibuildwheel --platform windows

bin/coverage.sh

+1-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ export PYTHON_FLINT_COVERAGE=true
3333

3434
python setup.py build_ext --inplace
3535

36-
pytest --cov flint test/test.py
37-
coverage run --append test/dtest.py
36+
coverage run -m flint.test $@
3837

3938
#coverage report -m
4039
coverage html

bin/pip_install_ubuntu.sh

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
#!/bin/bash
2+
3+
set -o errexit
4+
5+
# This script should work to install python-flint on Ubuntu from a VCS checkout
6+
#
7+
# $ git checkout https://github.com/fredrik-johansson/python-flint.git
8+
# $ bin/pip_install_ubuntu.sh .
9+
#
10+
# To install an sdist from PyPI, use
11+
#
12+
# $ bin/pip_install_ubuntu.sh python-flint
13+
#
14+
15+
# Install runtime and build dependencies
16+
17+
# The commented commands below would attempt to build python-flint against a
18+
# system installation of Flint and Arb in Ubuntu.
19+
#
20+
# Ubuntu 23.04 has Flint 2.9.0 and Arb 2.23.0, so this script might work there
21+
# (for python-flint 0.4.1). That is untested though (23.04 not available in CI).
22+
#
23+
# With Ubuntu 22.04, this will build but then crashes when running the tests.
24+
# most likely this is because the versions of flint and flint-arb are too old.
25+
# At the time of writing in Ubuntu 22.04 there is Flint 2.8.4 and Arb 2.22. The
26+
# main CI tests and wheels for python-flint 0.4.1 are built with Flint 2.9.0
27+
# and Arb 2.23.0.
28+
#
29+
# Link against libflint-arb instead of libarb on Ubuntu
30+
# export PYTHON_FLINT_LIBFLINT_ARB=1
31+
# sudo apt-get update
32+
# sudo apt-get install libflint-dev libflint-arb-dev
33+
34+
35+
# Build Flint and Arb manually
36+
#
37+
# First install their dependencies and build dependencies
38+
sudo apt-get update
39+
sudo apt-get install libgmp-dev libmpfr-dev xz-utils
40+
41+
# Only these *EXACT* versions will work.
42+
FLINTVER=2.9.0
43+
ARBVER=2.23.0
44+
45+
# This will default to installing in /usr/local. If you want to install in a
46+
# non-standard location then configure flint with
47+
# ./configure --disable-static --prefix=$PREFIX
48+
# and arb with
49+
# ./configure --disable-static --prefix=$PREFIX --with-flint=$PREFIX
50+
# If $PREFIX is no in default search paths, then at build time set
51+
# export C_INCLUDE_PATH=$PREFIX/include
52+
# and at runtime set
53+
# export LD_LIBRARY_PATH=$PREFIX/lib
54+
55+
curl -O -L https://www.flintlib.org/flint-$FLINTVER.tar.gz
56+
tar xf flint-$FLINTVER.tar.gz
57+
cd flint-$FLINTVER
58+
./configure --disable-static
59+
make -j
60+
sudo make install
61+
cd ..
62+
63+
curl -O -L https://github.com/fredrik-johansson/arb/archive/refs/tags/$ARBVER.tar.gz
64+
mv $ARBVER.tar.gz arb-$ARBVER.tar.gz
65+
tar xf arb-$ARBVER.tar.gz
66+
cd arb-$ARBVER
67+
./configure --disable-static
68+
make -j
69+
sudo make install
70+
cd ..
71+
72+
ls -l /usr/local/lib
73+
sudo ldconfig /usr/local/lib
74+
75+
# Python build requirements. Ideally these would be in pyprojec.toml, but
76+
# first need to migrate from setup.py to pyproject.toml.
77+
pip install 'cython>=3' numpy wheel
78+
79+
# Install from checkout (or sdist).
80+
echo -----------------------------------------------------------
81+
echo
82+
echo Running:
83+
echo $ pip install --no-build-isolation $1
84+
echo
85+
echo -----------------------------------------------------------
86+
87+
pip install --no-build-isolation $1

doc/source/conf.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@
5151
# built documents.
5252
#
5353
# The short X.Y version.
54-
version = '0.4.0'
54+
version = '0.4.1'
5555
# The full version, including alpha/beta/rc tags.
56-
release = '0.4.0'
56+
release = '0.4.1'
5757

5858
# The language for content autogenerated by Sphinx. Refer to documentation
5959
# for a list of supported languages.

doc/source/setup.rst

+2-4
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ Then run::
4242

4343
Run the test suite::
4444

45-
python test/test.py
46-
python test/dtest.py
45+
python -m flint.test
4746

4847
Build the documentation::
4948

@@ -86,8 +85,7 @@ you can then build Python-FLINT in place with::
8685

8786
and run the test suite with::
8887

89-
python test/test.py
90-
python test/dtest.py
88+
python -m flint.test
9189

9290
This way of building Python-FLINT depends on the ``bin/activate`` script to
9391
locate the shared libraries at runtime. The script will also set ``PYTHONPATH``

setup.py

+11-3
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,13 @@
3434
# For the MSVC toolchain link with mpir instead of gmp
3535
libraries = ["arb", "flint", "mpir", "mpfr", "pthreads"]
3636
else:
37-
libraries = ["arb", "flint"]
37+
# On Ubuntu libarb.so is called libflint-arb.so
38+
if os.getenv('PYTHON_FLINT_LIBFLINT_ARB'):
39+
arb = 'flint-arb'
40+
else:
41+
arb = 'arb'
42+
43+
libraries = [arb, "flint"]
3844
(opt,) = get_config_vars('OPT')
3945
os.environ['OPT'] = " ".join(flag for flag in opt.split() if flag != '-Wstrict-prototypes')
4046

@@ -75,10 +81,12 @@
7581
cmdclass={'build_ext': build_ext},
7682
ext_modules=cythonize(ext_modules, compiler_directives=compiler_directives),
7783
#ext_modules=cythonize(ext_modules, compiler_directives=compiler_directives, annotate=True),
78-
packages=['flint'],
84+
packages=['flint', 'flint.test'],
7985
package_dir={'': 'src'},
8086
description='Bindings for FLINT and Arb',
81-
version='0.4.0',
87+
long_description=open('README.md').read(),
88+
long_description_content_type='text/markdown',
89+
version='0.4.1',
8290
url='https://github.com/python-flint/python-flint',
8391
author='Fredrik Johansson',
8492
author_email='[email protected]',

src/flint/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
from ._flint import *
22

3-
__version__ = '0.4.0'
3+
__version__ = '0.4.1'

src/flint/test/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)