Skip to content

project: add `pyproject.toml` configuration

Chris Kay requested to merge chrkay01/pyproject-toml into main

The pyproject.toml file is a standard Python project configuration file, defined by PEP 518 and expanded upon in PEP 621, which centralises project metadata and build configuration.

The major benefit to this standard is the ability to automate the installation of project dependencies (both during development and for downstream users). As a result, it becomes possible to directly install Shrinkwrap and all of its runtime dependencies with any of:

uv tool install git+https://git.gitlab.arm.com/tooling/shrinkwrap.git
pipx install git+https://git.gitlab.arm.com/tooling/shrinkwrap.git
pip install git+https://git.gitlab.arm.com/tooling/shrinkwrap.git

This also makes it possible to build redistributable packages for distribution via PyPI, the Python Package Index.

If you are contributing to Shrinkwrap, it is strongly recommended that you install uv and set up a virtual environment:

curl -LsSf https://astral.sh/uv/install.sh | sh # Install uv

uv venv # Create a virtual environment in `${PWD}/.venv`
uv sync # Install Shrinkwrap's development dependencies

You can run commands within the virtual environment from outside of it:

uv run shrinkwrap --help

... or load the virtual environment and run them from wherever you are:

source .venv/bin/activate # Most modern IDEs can do this automatically
shrinkwrap --help

This change also moves the config directory to shrinkwrap/config, and creates a symlink from the original location to the new one to avoid breaking existing workflows.

This move is necessary to ensure that the configuration files are accessible via the importlib library, which allows a Python package to access bundled non-Python resources.

Without this move these configuration files would be unreachable by the program when installed (via e.g. pip install shrinkwrap) , as most Python build systems cannot bundle data from outside the package module tree (or they make it very awkward).

Edited by Chris Kay

Merge request reports

Loading