Skip to content

Commit

Permalink
Update pip build/package strategy to fix numpy compatibility (#867)
Browse files Browse the repository at this point in the history
* Test with docker pip_for_gudhi:3.8.0rc3. Use minimal python version to build gudhi and upgrade to test

* Typo in matrix variables

* Fix minimal numpy version

* Better use of ~= and some comments. Add some tests for pip packages

* osx x86 and arm numpy version stable from 1.21.4

* activate pytest verbosity and fix osx. Release candidate 3

* Get Dockerfile_for_pip old_numpy_pip_build feature from gudhi-deploy submodule

* Try to fix weird looking project description - cf. https://pypi.org/project/gudhi/3.8.0rc2/

* Build only python 3.6 for linux, 3.7 for windows and 3.8 for osx
  • Loading branch information
VincentRouvreau authored Apr 14, 2023
1 parent fc25535 commit b1917ab
Show file tree
Hide file tree
Showing 9 changed files with 110 additions and 30 deletions.
26 changes: 14 additions & 12 deletions .github/workflows/pip-build-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,25 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true
- name: Build wheel for Python 3.11
- name: Build wheel for Python 3.6
run: |
mkdir build_311
cd build_311
cmake -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=$PYTHON311/bin/python ..
mkdir build_36
cd build_36
cmake -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=$PYTHON36/bin/python ..
cd src/python
$PYTHON311/bin/python -m build -n -w
auditwheel show dist/*.whl
$PYTHON36/bin/python -m build -n -w
auditwheel repair dist/*.whl
ls wheelhouse/*.whl
- name: Install and test wheel for Python 3.11
- name: Install and test wheel for Python 3.6
run: |
$PYTHON311/bin/python -m pip install --user pytest build_311/src/python/wheelhouse/*.whl
$PYTHON311/bin/python -c "import gudhi; print(gudhi.__version__)"
$PYTHON311/bin/python -m pytest src/python/test/test_alpha_complex.py
$PYTHON36/bin/python -m pip install --user pytest build_36/src/python/dist/*.whl
$PYTHON36/bin/python -m pip install numpy --upgrade
$PYTHON36/bin/python -c "import gudhi; print(gudhi.__version__)"
$PYTHON36/bin/python -m pytest -v src/python/test/test_alpha_complex.py
$PYTHON36/bin/python -m pytest -v src/python/test/test_bottleneck_distance.py
$PYTHON36/bin/python -m pytest -v src/python/test/test_cubical_complex.py
$PYTHON36/bin/python -m pytest -v src/python/test/test_rips_complex.py
- name: Upload linux python wheel
uses: actions/upload-artifact@v3
with:
name: linux python wheel
path: build_311/src/python/wheelhouse/*.whl
path: build_36/src/python/wheelhouse/*.whl
18 changes: 14 additions & 4 deletions .github/workflows/pip-build-osx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: pip build osx
on: [push, pull_request]

env:
MACOSX_DEPLOYMENT_TARGET: 10.14
_PYTHON_HOST_PLATFORM: macosx-10.14-universal2
MACOSX_DEPLOYMENT_TARGET: 10.15
_PYTHON_HOST_PLATFORM: macosx-10.15-universal2
ARCHFLAGS: "-arch arm64 -arch x86_64"

jobs:
Expand All @@ -13,7 +13,12 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: ['3.11']
# numpy packages for osx x86 and arm are only available from 1.21.2, but stable for both versions from 1.21.4
# and python 3.8+
python-version: ['3.8']
include:
- python-version: '3.8'
numpy-version: '1.21.4'
name: Build wheels for Python ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v3
Expand All @@ -27,6 +32,7 @@ jobs:
run: |
brew update || true
brew install boost eigen gmp mpfr cgal || true
python -m pip install --user numpy~=${{ matrix.numpy-version }}
python -m pip install --user -r ext/gudhi-deploy/build-requirements.txt
python -m pip install --user delocate
./scripts/build_osx_universal_gmpfr.sh
Expand All @@ -46,9 +52,13 @@ jobs:
delocate-wheel --require-archs universal2 -v dist/*.whl
- name: Install and test python wheel
run: |
python -m pip install --user numpy --upgrade
python -m pip install --user pytest build/src/python/dist/*.whl
python -c "import gudhi; print(gudhi.__version__)"
python -m pytest src/python/test/test_alpha_complex.py
python -m pytest -v src/python/test/test_alpha_complex.py
python -m pytest -v src/python/test/test_bottleneck_distance.py
python -m pytest -v src/python/test/test_cubical_complex.py
python -m pytest -v src/python/test/test_rips_complex.py
- name: Upload OSx python wheel
uses: actions/upload-artifact@v3
with:
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/pip-build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: ['3.11']
python-version: ['3.7']
include:
- python-version: '3.7'
numpy-version: '1.15.0'
name: Build wheels for Python ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v3
Expand All @@ -24,6 +27,7 @@ jobs:
vcpkg install eigen3 cgal --triplet x64-windows
vcpkg version
ls "C:\vcpkg\installed\x64-windows\bin\"
python -m pip install --user numpy~=${{ matrix.numpy-version }}
python -m pip install --user -r .\ext\gudhi-deploy\build-requirements.txt
- name: Build python wheel and install it
run: |
Expand All @@ -41,9 +45,13 @@ jobs:
run: |
Get-Location
dir
python -m pip install --user numpy --upgrade
python -m pip install --user pytest
python -c "import gudhi; print(gudhi.__version__)"
python -m pytest ".\src\python\test\test_alpha_complex.py"
python -m pytest -v ".\src\python\test\test_alpha_complex.py"
python -m pytest -v ".\src\python\test\test_bottleneck_distance.py"
python -m pytest -v ".\src\python\test\test_cubical_complex.py"
python -m pytest -v ".\src\python\test\test_rips_complex.py"
- name: Upload Windows python wheel
uses: actions/upload-artifact@v3
with:
Expand Down
36 changes: 30 additions & 6 deletions .github/workflows/pip-packaging-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@ jobs:
- name: Install and test wheel for Python 3.6
run: |
$PYTHON36/bin/python -m pip install --user pytest build_36/src/python/dist/*.whl
$PYTHON36/bin/python -m pip install numpy --upgrade
$PYTHON36/bin/python -c "import gudhi; print(gudhi.__version__)"
$PYTHON36/bin/python -m pytest src/python/test/test_alpha_complex.py
$PYTHON36/bin/python -m pytest -v src/python/test/test_alpha_complex.py
$PYTHON36/bin/python -m pytest -v src/python/test/test_bottleneck_distance.py
$PYTHON36/bin/python -m pytest -v src/python/test/test_cubical_complex.py
$PYTHON36/bin/python -m pytest -v src/python/test/test_rips_complex.py
- name: Build wheel for Python 3.7
run: |
mkdir build_37
Expand All @@ -38,8 +42,12 @@ jobs:
- name: Install and test wheel for Python 3.7
run: |
$PYTHON37/bin/python -m pip install --user pytest build_37/src/python/dist/*.whl
$PYTHON37/bin/python -m pip install numpy --upgrade
$PYTHON37/bin/python -c "import gudhi; print(gudhi.__version__)"
$PYTHON37/bin/python -m pytest src/python/test/test_alpha_complex.py
$PYTHON37/bin/python -m pytest -v src/python/test/test_alpha_complex.py
$PYTHON37/bin/python -m pytest -v src/python/test/test_bottleneck_distance.py
$PYTHON37/bin/python -m pytest -v src/python/test/test_cubical_complex.py
$PYTHON37/bin/python -m pytest -v src/python/test/test_rips_complex.py
- name: Build wheel for Python 3.8
run: |
mkdir build_38
Expand All @@ -51,8 +59,12 @@ jobs:
- name: Install and test wheel for Python 3.8
run: |
$PYTHON38/bin/python -m pip install --user pytest build_38/src/python/dist/*.whl
$PYTHON38/bin/python -m pip install numpy --upgrade
$PYTHON38/bin/python -c "import gudhi; print(gudhi.__version__)"
$PYTHON38/bin/python -m pytest src/python/test/test_alpha_complex.py
$PYTHON38/bin/python -m pytest -v src/python/test/test_alpha_complex.py
$PYTHON38/bin/python -m pytest -v src/python/test/test_bottleneck_distance.py
$PYTHON38/bin/python -m pytest -v src/python/test/test_cubical_complex.py
$PYTHON38/bin/python -m pytest -v src/python/test/test_rips_complex.py
- name: Build wheel for Python 3.9
run: |
mkdir build_39
Expand All @@ -64,8 +76,12 @@ jobs:
- name: Install and test wheel for Python 3.9
run: |
$PYTHON39/bin/python -m pip install --user pytest build_39/src/python/dist/*.whl
$PYTHON39/bin/python -m pip install numpy --upgrade
$PYTHON39/bin/python -c "import gudhi; print(gudhi.__version__)"
$PYTHON39/bin/python -m pytest src/python/test/test_alpha_complex.py
$PYTHON39/bin/python -m pytest -v src/python/test/test_alpha_complex.py
$PYTHON39/bin/python -m pytest -v src/python/test/test_bottleneck_distance.py
$PYTHON39/bin/python -m pytest -v src/python/test/test_cubical_complex.py
$PYTHON39/bin/python -m pytest -v src/python/test/test_rips_complex.py
- name: Build wheel for Python 3.10
run: |
mkdir build_310
Expand All @@ -77,8 +93,12 @@ jobs:
- name: Install and test wheel for Python 3.10
run: |
$PYTHON310/bin/python -m pip install --user pytest build_310/src/python/dist/*.whl
$PYTHON310/bin/python -m pip install numpy --upgrade
$PYTHON310/bin/python -c "import gudhi; print(gudhi.__version__)"
$PYTHON310/bin/python -m pytest src/python/test/test_alpha_complex.py
$PYTHON310/bin/python -m pytest -v src/python/test/test_alpha_complex.py
$PYTHON310/bin/python -m pytest -v src/python/test/test_bottleneck_distance.py
$PYTHON310/bin/python -m pytest -v src/python/test/test_cubical_complex.py
$PYTHON310/bin/python -m pytest -v src/python/test/test_rips_complex.py
- name: Build wheel for Python 3.11
run: |
mkdir build_311
Expand All @@ -90,8 +110,12 @@ jobs:
- name: Install and test wheel for Python 3.11
run: |
$PYTHON311/bin/python -m pip install --user pytest build_311/src/python/dist/*.whl
$PYTHON311/bin/python -m pip install numpy --upgrade
$PYTHON311/bin/python -c "import gudhi; print(gudhi.__version__)"
$PYTHON311/bin/python -m pytest src/python/test/test_alpha_complex.py
$PYTHON311/bin/python -m pytest -v src/python/test/test_alpha_complex.py
$PYTHON311/bin/python -m pytest -v src/python/test/test_bottleneck_distance.py
$PYTHON311/bin/python -m pytest -v src/python/test/test_cubical_complex.py
$PYTHON311/bin/python -m pytest -v src/python/test/test_rips_complex.py
- name: Publish on PyPi
env:
TWINE_USERNAME: __token__
Expand Down
22 changes: 20 additions & 2 deletions .github/workflows/pip-packaging-osx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,20 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
# numpy packages for osx x86 and arm are only available from 1.21.2, but stable for both versions from 1.21.4
# and python 3.8+
python-version: ['3.8', '3.9', '3.10', '3.11']
include:
# numpy >= 1.21.4 fort osx x86 and arm, but minimal numpy version for python 3.10 is 1.21.6 for instance
# numpy~=1.21.6 means any numpy=1.21.*, but also numpy>=1.21.6 (numpy~=1.21 do not work as it means any numpy==1.*)
- python-version: '3.8'
numpy-version: '1.21.4'
- python-version: '3.9'
numpy-version: '1.21.4'
- python-version: '3.10'
numpy-version: '1.21.6'
- python-version: '3.11'
numpy-version: '1.23.2'
name: Build wheels for Python ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v3
Expand All @@ -29,6 +42,7 @@ jobs:
run: |
brew update || true
brew install boost eigen gmp mpfr cgal || true
python -m pip install --user numpy~=${{ matrix.numpy-version }}
python -m pip install --user -r ext/gudhi-deploy/build-requirements.txt
python -m pip install --user twine delocate
./scripts/build_osx_universal_gmpfr.sh
Expand All @@ -46,9 +60,13 @@ jobs:
python -m build -n -w
- name: Install and test python wheel
run: |
python -m pip install --user numpy --upgrade
python -m pip install --user pytest build/src/python/dist/*.whl
python -c "import gudhi; print(gudhi.__version__)"
python -m pytest src/python/test/test_alpha_complex.py
python -m pytest -v src/python/test/test_alpha_complex.py
python -m pytest -v src/python/test/test_bottleneck_distance.py
python -m pytest -v src/python/test/test_cubical_complex.py
python -m pytest -v src/python/test/test_rips_complex.py
- name: Publish on PyPi
env:
TWINE_USERNAME: __token__
Expand Down
20 changes: 19 additions & 1 deletion .github/workflows/pip-packaging-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,19 @@ jobs:
max-parallel: 4
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
# gudhi requires numpy >= 1.15.0, but minimal numpy version for python 3.8 is 1.17.3 for instance
# numpy~=1.17.3 means any numpy=1.17.*, but also numpy>=1.17.3 (numpy~=1.17 do not work as it means any numpy==1.*)
include:
- python-version: '3.7'
numpy-version: '1.15.0'
- python-version: '3.8'
numpy-version: '1.17.3'
- python-version: '3.9'
numpy-version: '1.19.3'
- python-version: '3.10'
numpy-version: '1.21.6'
- python-version: '3.11'
numpy-version: '1.23.2'
name: Build wheels for Python ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v3
Expand All @@ -26,6 +39,7 @@ jobs:
vcpkg install eigen3 cgal --triplet x64-windows
vcpkg version
ls "C:\vcpkg\installed\x64-windows\bin\"
python -m pip install --user numpy~=${{ matrix.numpy-version }}
python -m pip install --user -r .\ext\gudhi-deploy\build-requirements.txt
python -m pip install --user twine
python -m pip list
Expand All @@ -43,9 +57,13 @@ jobs:
Get-ChildItem *.whl | ForEach-Object{python -m pip install --user $_.Name}
- name: Test python wheel
run: |
python -m pip install --user numpy --upgrade
python -m pip install --user pytest
python -c "import gudhi; print(gudhi.__version__)"
python -m pytest ".\src\python\test\test_alpha_complex.py"
python -m pytest -v ".\src\python\test\test_alpha_complex.py"
python -m pytest -v ".\src\python\test\test_bottleneck_distance.py"
python -m pytest -v ".\src\python\test\test_cubical_complex.py"
python -m pytest -v ".\src\python\test\test_rips_complex.py"
- name: Publish on PyPi
env:
TWINE_USERNAME: __token__
Expand Down
2 changes: 1 addition & 1 deletion CMakeGUDHIVersion.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set (GUDHI_MAJOR_VERSION 3)
set (GUDHI_MINOR_VERSION 8)
# GUDHI_PATCH_VERSION can be 'ZaN' for Alpha release, 'ZbN' for Beta release, 'ZrcN' for release candidate or 'Z' for a final release.
set (GUDHI_PATCH_VERSION 0rc2)
set (GUDHI_PATCH_VERSION 0rc3)
set(GUDHI_VERSION ${GUDHI_MAJOR_VERSION}.${GUDHI_MINOR_VERSION}.${GUDHI_PATCH_VERSION})

message(STATUS "GUDHI version : ${GUDHI_VERSION}")
2 changes: 1 addition & 1 deletion ext/gudhi-deploy
2 changes: 1 addition & 1 deletion src/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ if(PYTHONINTERP_FOUND)

# Generate setup.py file to cythonize Gudhi - This file must be named setup.py by convention
file(READ "introduction.rst" GUDHI_LONG_DESCRIPTION_WITH_UNPROPER_CR)
string(REPLACE "\n" "' \\\n '" GUDHI_LONG_DESCRIPTION ${GUDHI_LONG_DESCRIPTION_WITH_UNPROPER_CR})
string(REPLACE "\n" "\\n' \\\n '" GUDHI_LONG_DESCRIPTION ${GUDHI_LONG_DESCRIPTION_WITH_UNPROPER_CR})
configure_file(setup.py.in "${CMAKE_CURRENT_BINARY_DIR}/setup.py" @ONLY)

# Generate gudhi/__init__.py
Expand Down

0 comments on commit b1917ab

Please sign in to comment.