summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Rouvreau <10407034+VincentRouvreau@users.noreply.github.com>2023-01-12 21:46:50 +0100
committerGitHub <noreply@github.com>2023-01-12 21:46:50 +0100
commit533efd51253b0770f9a7de04a42f0820f1a1af66 (patch)
treeb984a57753f723513095fc11489dccd25923715b
parentfd7ca7ad464fbd5fef42802a30ae8f74dffe938e (diff)
parent14a0e7bc0a89ab5d576c39ffd596843608fbf1dc (diff)
Merge pull request #769 from VincentRouvreau/strip_python_modules
Python pip modules enhancements
-rw-r--r--.github/workflows/pip-build-linux.yml11
-rw-r--r--.github/workflows/pip-build-osx.yml9
-rw-r--r--.github/workflows/pip-build-windows.yml11
-rw-r--r--.github/workflows/pip-packaging-linux.yml12
-rw-r--r--.github/workflows/pip-packaging-osx.yml4
-rw-r--r--.github/workflows/pip-packaging-windows.yml6
-rw-r--r--src/python/CMakeLists.txt7
7 files changed, 40 insertions, 20 deletions
diff --git a/.github/workflows/pip-build-linux.yml b/.github/workflows/pip-build-linux.yml
index bc4f999e..88ca7db3 100644
--- a/.github/workflows/pip-build-linux.yml
+++ b/.github/workflows/pip-build-linux.yml
@@ -18,10 +18,17 @@ jobs:
cd build_311
cmake -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=$PYTHON311/bin/python ..
cd src/python
- $PYTHON311/bin/python setup.py bdist_wheel
+ $PYTHON311/bin/python -m build -n
+ auditwheel show dist/*.whl
auditwheel repair dist/*.whl
+ ls wheelhouse/*.whl
- 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 --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
+ - name: Upload linux python wheel
+ uses: actions/upload-artifact@v3
+ with:
+ name: linux python wheel
+ path: build_311/src/python/wheelhouse/*.whl
diff --git a/.github/workflows/pip-build-osx.yml b/.github/workflows/pip-build-osx.yml
index a438124a..81f516cd 100644
--- a/.github/workflows/pip-build-osx.yml
+++ b/.github/workflows/pip-build-osx.yml
@@ -28,7 +28,7 @@ jobs:
brew update || true
brew install boost eigen gmp mpfr cgal || true
python -m pip install --user -r ext/gudhi-deploy/build-requirements.txt
- python -m pip install --user twine delocate
+ python -m pip install --user build twine delocate
./scripts/build_osx_universal_gmpfr.sh
# Now the universal libraries are in $PWD/deps-uni/lib
- name: Build python wheel
@@ -41,7 +41,7 @@ jobs:
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DPython_ADDITIONAL_VERSIONS=3 ..
cd src/python
- python setup.py bdist_wheel
+ python -m build -n
export PATH="$PATH:`python -m site --user-base`/bin"
delocate-wheel --require-archs universal2 -v dist/*.whl
- name: Install and test python wheel
@@ -49,3 +49,8 @@ jobs:
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
+ - name: Upload OSx python wheel
+ uses: actions/upload-artifact@v3
+ with:
+ name: osx python wheel
+ path: build/src/python/dist/*.whl
diff --git a/.github/workflows/pip-build-windows.yml b/.github/workflows/pip-build-windows.yml
index 50bdfe2c..02617e31 100644
--- a/.github/workflows/pip-build-windows.yml
+++ b/.github/workflows/pip-build-windows.yml
@@ -25,18 +25,16 @@ jobs:
vcpkg version
ls "C:\vcpkg\installed\x64-windows\bin\"
python -m pip install --user -r .\ext\gudhi-deploy\build-requirements.txt
- python -m pip list
+ python -m pip install --user build
- name: Build python wheel and install it
run: |
mkdir build
cd ".\build\"
cmake -DCMAKE_BUILD_TYPE=Release -DFORCE_EIGEN_DEFAULT_DENSE_INDEX_TYPE_TO_INT=ON -DCMAKE_TOOLCHAIN_FILE=c:\vcpkg\scripts\buildsystems\vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows ..
- Get-Location
- dir
cd ".\src\python\"
cp "C:\vcpkg\installed\x64-windows\bin\mpfr*.dll" ".\gudhi\"
cp "C:\vcpkg\installed\x64-windows\bin\gmp*.dll" ".\gudhi\"
- python setup.py bdist_wheel
+ python -m build -n
ls ".\dist\"
cd ".\dist\"
Get-ChildItem *.whl | ForEach-Object{python -m pip install --user $_.Name}
@@ -47,3 +45,8 @@ jobs:
python -m pip install --user pytest
python -c "import gudhi; print(gudhi.__version__)"
python -m pytest ".\src\python\test\test_alpha_complex.py"
+ - name: Upload Windows python wheel
+ uses: actions/upload-artifact@v3
+ with:
+ name: windows python wheel
+ path: build/src/python/dist/*.whl
diff --git a/.github/workflows/pip-packaging-linux.yml b/.github/workflows/pip-packaging-linux.yml
index 14b1cf7a..866f4335 100644
--- a/.github/workflows/pip-packaging-linux.yml
+++ b/.github/workflows/pip-packaging-linux.yml
@@ -20,7 +20,7 @@ jobs:
cd build_36
cmake -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=$PYTHON36/bin/python ..
cd src/python
- $PYTHON36/bin/python setup.py bdist_wheel
+ $PYTHON36/bin/python -m build -n
auditwheel repair dist/*.whl
- name: Install and test wheel for Python 3.6
run: |
@@ -33,7 +33,7 @@ jobs:
cd build_37
cmake -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=$PYTHON37/bin/python ..
cd src/python
- $PYTHON37/bin/python setup.py bdist_wheel
+ $PYTHON37/bin/python -m build -n
auditwheel repair dist/*.whl
- name: Install and test wheel for Python 3.7
run: |
@@ -46,7 +46,7 @@ jobs:
cd build_38
cmake -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=$PYTHON38/bin/python ..
cd src/python
- $PYTHON38/bin/python setup.py bdist_wheel
+ $PYTHON38/bin/python -m build -n
auditwheel repair dist/*.whl
- name: Install and test wheel for Python 3.8
run: |
@@ -59,7 +59,7 @@ jobs:
cd build_39
cmake -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=$PYTHON39/bin/python ..
cd src/python
- $PYTHON39/bin/python setup.py bdist_wheel
+ $PYTHON39/bin/python -m build -n
auditwheel repair dist/*.whl
- name: Install and test wheel for Python 3.9
run: |
@@ -72,7 +72,7 @@ jobs:
cd build_310
cmake -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=$PYTHON310/bin/python ..
cd src/python
- $PYTHON310/bin/python setup.py bdist_wheel
+ $PYTHON310/bin/python -m build -n
auditwheel repair dist/*.whl
- name: Install and test wheel for Python 3.10
run: |
@@ -85,7 +85,7 @@ jobs:
cd build_311
cmake -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=$PYTHON311/bin/python ..
cd src/python
- $PYTHON311/bin/python setup.py bdist_wheel
+ $PYTHON311/bin/python -m build -n
auditwheel repair dist/*.whl
- name: Install and test wheel for Python 3.11
run: |
diff --git a/.github/workflows/pip-packaging-osx.yml b/.github/workflows/pip-packaging-osx.yml
index 9ddbcfce..15840c9a 100644
--- a/.github/workflows/pip-packaging-osx.yml
+++ b/.github/workflows/pip-packaging-osx.yml
@@ -30,7 +30,7 @@ jobs:
brew update || true
brew install boost eigen gmp mpfr cgal || true
python -m pip install --user -r ext/gudhi-deploy/build-requirements.txt
- python -m pip install --user twine delocate
+ python -m pip install --user build twine delocate
./scripts/build_osx_universal_gmpfr.sh
# Now the universal libs are in $PWD/deps-uni/lib
- name: Build python wheel
@@ -43,7 +43,7 @@ jobs:
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DPython_ADDITIONAL_VERSIONS=3 ..
cd src/python
- python setup.py bdist_wheel
+ python -m build -n
- name: Install and test python wheel
run: |
python -m pip install --user pytest build/src/python/dist/*.whl
diff --git a/.github/workflows/pip-packaging-windows.yml b/.github/workflows/pip-packaging-windows.yml
index df0db9a5..e5a7d817 100644
--- a/.github/workflows/pip-packaging-windows.yml
+++ b/.github/workflows/pip-packaging-windows.yml
@@ -27,19 +27,17 @@ jobs:
vcpkg version
ls "C:\vcpkg\installed\x64-windows\bin\"
python -m pip install --user -r .\ext\gudhi-deploy\build-requirements.txt
- python -m pip install --user twine
+ python -m pip install --user build twine
python -m pip list
- name: Build python wheel and install it
run: |
mkdir build
cd ".\build\"
cmake -DCMAKE_BUILD_TYPE=Release -DFORCE_EIGEN_DEFAULT_DENSE_INDEX_TYPE_TO_INT=ON -DCMAKE_TOOLCHAIN_FILE=c:\vcpkg\scripts\buildsystems\vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows ..
- Get-Location
- dir
cd ".\src\python\"
cp "C:\vcpkg\installed\x64-windows\bin\mpfr*.dll" ".\gudhi\"
cp "C:\vcpkg\installed\x64-windows\bin\gmp*.dll" ".\gudhi\"
- python setup.py bdist_wheel
+ python -m build -n
ls ".\dist\"
cd ".\dist\"
Get-ChildItem *.whl | ForEach-Object{python -m pip install --user $_.Name}
diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt
index 198d0c65..74d1c4c6 100644
--- a/src/python/CMakeLists.txt
+++ b/src/python/CMakeLists.txt
@@ -251,6 +251,13 @@ if(PYTHONINTERP_FOUND)
set(GUDHI_PYTHON_EXTRA_LINK_ARGS "${GUDHI_PYTHON_EXTRA_LINK_ARGS}'-mmacosx-version-min=10.14', ")
endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ # Strip dynamic libraries in release mode for smaller pip packages under linux
+ if(CMAKE_COMPILER_IS_GNUCXX)
+ if(CMAKE_BUILD_TYPE MATCHES Release)
+ set(GUDHI_PYTHON_EXTRA_LINK_ARGS "${GUDHI_PYTHON_EXTRA_LINK_ARGS}'-s', ")
+ endif(CMAKE_BUILD_TYPE MATCHES Release)
+ endif(CMAKE_COMPILER_IS_GNUCXX)
+
# Loop on INCLUDE_DIRECTORIES PROPERTY
get_property(GUDHI_INCLUDE_DIRECTORIES DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
foreach(GUDHI_INCLUDE_DIRECTORY ${GUDHI_INCLUDE_DIRECTORIES})