tree: 3ac539973a88194bbf06086c1b053b2309baa24f [path history] [tgz]
  1. .gitignore
  2. build_linux_packages.sh
  3. build_macos_packages.sh
  4. build_windows_packages.ps1
  5. compute_common_version.py
  6. compute_local_version.py
  7. install_macos_deps.sh
  8. install_windows_deps.ps1
  9. promote_whl_from_rc_to_final.py
  10. pypi_deploy.sh
  11. pypi_deploy_requirements.txt
  12. README.md
build_tools/python_deploy/README.md

Python Deployment

These scripts assist with building Python packages and pushing them to PyPI (the Python Package Index). See also

Overview

See comments in scripts for canonical usage. This page includes additional notes.

Package building

These scripts build all packages we maintain, for all Python versions and platforms that we support:

To assist with environment setup, we use a manylinux Docker image for Linux builds and these scripts on other platforms:

Version management

These scripts handle versioning across packages, including considerations like major, minor, and patch levels (X.Y.Z), as well as suffixes like rc20241107 or dev+{git hash}:

PyPI deployment

These scripts handle promoting nightly releases packages to stable and pushing to PyPI:

Both of these scripts expect to have the dependencies from pypi_deploy_requirements.txt installed. This can be easily managed by using a Python virtual environment:

python -m venv .venv
source .venv/bin/activate
python -m pip install -r ./pypi_deploy_requirements.txt

Debugging manylinux builds

We build releases under a manylinux derived docker image. When all goes well, things are great, but when they fail, it often implicates something that has to do with Linux age-based arcana. In this situation, just getting to the shell and building/poking can be the most useful way to triage.

Here is the procedure:

[host ~/iree]$ docker run --interactive --tty --rm -v $(pwd):/work/iree gcr.io/iree-oss/manylinux2014_x86_64-release:prod
[root@c8f6d0041d79 /]# export PATH=/opt/python/cp310-cp310/bin:$PATH
[root@c8f6d0041d79 /]# python --version
Python 3.10.4


# Two paths for further work.
# Option A: Build like a normal dev setup (i.e. if allergic to Python
# packaging and to triage issues that do not implicate that).
[root@c8f6d0041d79 ]# cd /work/iree
[root@c8f6d0041d79 iree]# pip install wheel cmake ninja pybind11 numpy
[root@c8f6d0041d79 iree]# cmake -GNinja -B ../iree-build/ -S . -DCMAKE_BUILD_TYPE=Release -DIREE_BUILD_PYTHON_BINDINGS=ON
[root@c8f6d0041d79 iree]# cd ../iree-build/
[root@c8f6d0041d79 iree-build]# ninja

# Options B: Creates Python packages exactly as the CI/scripts do.
# (to be used when there is Python arcana involved). The result is organized
# differently from a usual dev flow and may be subsequently more confusing to
# the uninitiated.
[root@c8f6d0041d79 iree]# pip wheel compiler/
[root@c8f6d0041d79 iree]# pip wheel runtime/