tree: 4cc7e873f8b09fc00056fca3e96ef42c2e57d74c [path history] [tgz]
  1. _static/
  2. compiler/
  3. .gitignore
  4. .readthedocs.yaml
  5. conf.py
  6. index.rst
  7. Makefile
  8. README.md
  9. requirements.txt
  10. runtime.rst
docs/api_docs/python/README.md

Python API Docs

Documentation for the Python API is built with Sphinx under this directory. When new versions are released, the documentation is generated and published to the Read the Docs project and is served at readthedocs.io.

Building the API documentation locally

Setup virtual environment with requirements

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

(Optional) Using locally built IREE packages

You can build the site using either released Python packages or local packages, whichever appear first on the PYTHONPATH environment variable. The requirements.txt file used in the previous step downloads the latest pre-release (nightly) iree-base-compiler and iree-base-runtime packages.

To use local packages, such as when changing docstrings and wanting to see how they appear in the generated documentation, follow the instructions for building the Python bindings from source at https://iree.dev/building-from-source/getting-started/#using-the-python-bindings.

In particular, after building with -DIREE_BUILD_PYTHON_BINDINGS=ON, you will need to extend your PYTHONPATH to include the relevant build directories. The the generated .env files can help with this:

source ../../../iree-build/.env && export PYTHONPATH

Build docs

sphinx-build -b html . _build

Serve locally locally with autoreload

sphinx-autobuild . _build

Then open http://127.0.0.1:8000 as instructed by the logs and make changes to the files in this directory as needed to update the documentation.

Clean to show all warnings

A clean rebuild will show all warnings again:

make clean
sphinx-build -b html . _build