|
| 1 | +# PyPI wheels |
| 2 | + |
| 3 | +The pythonocc-core wheels published on PyPI are built by |
| 4 | +[cibuildwheel](https://cibuildwheel.pypa.io) in the GitHub Actions workflow |
| 5 | +`.github/workflows/wheels.yml`: |
| 6 | + |
| 7 | +| Platform | Wheels | Runner | |
| 8 | +|----------|--------------------------------------------|------------------------------| |
| 9 | +| Linux | `manylinux_2_28_x86_64`, `manylinux_2_28_aarch64` | `ubuntu-24.04`, `ubuntu-24.04-arm` | |
| 10 | +| macOS | `macosx_11_0_x86_64`, `macosx_11_0_arm64` | `macos-15-intel`, `macos-15` | |
| 11 | +| Windows | `win_amd64` | `windows-2022` | |
| 12 | + |
| 13 | +for CPython 3.10 to 3.14, plus the sdist. |
| 14 | + |
| 15 | +* `pyproject.toml`: the scikit-build-core build, the version is read from |
| 16 | + `CMakeLists.txt`, and the cibuildwheel configuration. |
| 17 | +* `deps/`: the native dependencies build scripts: SWIG, OCCT and its 3rd |
| 18 | + parties (freetype, FreeImage, RapidJSON). |
| 19 | + * Linux: built in the manylinux_2_28 container, 3rd parties from the |
| 20 | + system (EPEL for FreeImage). |
| 21 | + * macOS, Windows: built on the runner, 3rd parties built by vcpkg through |
| 22 | + the OCCT vcpkg manifest, with the triplets of `triplets/`. |
| 23 | + |
| 24 | +For each platform, a first job builds the dependencies and saves them to the |
| 25 | +GitHub cache (the key is a hash of the platform scripts and triplet), then one |
| 26 | +job per Python version restores them and builds and tests a wheel. The |
| 27 | +libraries are vendored in the wheels by auditwheel (Linux), delocate (macOS) |
| 28 | +and delvewheel (Windows). |
| 29 | + |
| 30 | +The workflow runs on the pushes to master and review/* that change the |
| 31 | +packaging, on demand (workflow_dispatch), and on the tags. |
| 32 | + |
| 33 | +## Releasing |
| 34 | + |
| 35 | +Pushing a tag builds the wheels and the sdist and uploads them to PyPI |
| 36 | +through [trusted publishing](https://docs.pypi.org/trusted-publishers/). |
| 37 | +This requires, once: |
| 38 | + |
| 39 | +* on PyPI, a trusted publisher for the `pythonocc-core` project: owner |
| 40 | + `tpaviot`, repository `pythonocc-core`, workflow `wheels.yml`, environment |
| 41 | + `pypi`. |
| 42 | +* on GitHub, a `pypi` environment in the repository settings (optionally |
| 43 | + with required reviewers, to approve each upload). |
| 44 | + |
| 45 | +When upgrading SWIG or OCCT, update the versions in the three `deps/` |
| 46 | +scripts, the cache is invalidated by their change. |
| 47 | + |
| 48 | +## Building locally |
| 49 | + |
| 50 | +Linux wheels can be built on any machine with docker: |
| 51 | + |
| 52 | +```bash |
| 53 | +pip install cibuildwheel |
| 54 | +# optional: cache SWIG and OCCT between runs (/host is the host filesystem) |
| 55 | +export PYOCC_DEPS_CACHE=/host$HOME/.cache/pyocc-deps |
| 56 | +CIBW_BUILD='cp312-*' cibuildwheel --platform linux |
| 57 | +``` |
| 58 | + |
| 59 | +from a clean checkout: cibuildwheel copies the whole source tree into the |
| 60 | +container. |
0 commit comments