Skip to content

Commit

Permalink
Merge pull request #769 from VincentRouvreau/strip_python_modules
Browse files Browse the repository at this point in the history
Python pip modules enhancements
  • Loading branch information
VincentRouvreau authored Jan 12, 2023
2 parents fd7ca7a + 14a0e7b commit 533efd5
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 20 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/pip-build-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 7 additions & 2 deletions .github/workflows/pip-build-osx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -41,11 +41,16 @@ 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
run: |
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
11 changes: 7 additions & 4 deletions .github/workflows/pip-build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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
12 changes: 6 additions & 6 deletions .github/workflows/pip-packaging-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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: |
Expand All @@ -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: |
Expand All @@ -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: |
Expand All @@ -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: |
Expand All @@ -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: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pip-packaging-osx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/pip-packaging-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
7 changes: 7 additions & 0 deletions src/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down

0 comments on commit 533efd5

Please sign in to comment.