Bygg is in early stage of development. It is usable and useful for its currently implemented use cases. Feel free to try it out, but also expect things to change and evolve. Feedback and bug reports are welcome!
Introduction
Bygg is a build system implemented in and configured using Python. It is general-purpose, but is aimed at those that (want to) use Python to glue together other systems.
Bygg tries to get out of your way and be as thin as possible, while still providing correctness and minimal rebuilds.
Basics
- Specify actions in pure Python.
- Actions can depend on other actions.
- An action will be executed if the digests of its source or output files have changed.
Installation
Bygg requires Python 3.11 or higher.
Install with
pipx install bygg or uv tool install bygg (recommended)
or
pip install bygg
or in a virtual environment.
Usage
Specify the actions in Byggfile.py in your source directory. Either wrap the
action function using the @action decorator, or use the Action constructor
directly.
# Decorator:
@action(
"build1",
inputs=["foo.in", "bar.in"],
outputs=["foo.out", "bar.out"],
is_entrypoint=True
)
def a_build_command(ctx: ActionContext):
# do stuff
...
# Separate function + Action constructor:
def also_a_build_command(ctx: ActionContext):
# do stuff
...
Action(
"build2",
inputs=["foo.in", "bar.in"],
outputs=["foo.out", "bar.out"],
dependencies=["another action"],
command=also_a_build_command,
is_entrypoint=True
)
Bygg will check for the presence of Byggfile.py in the current directory. The
actions above would be built with bygg build1 and bygg build2,
respectively. See the examples/ directory for worked examples.
Environments
Bygg can manage virtual environments. See examples/environments/Byggfile.toml
for an example.
Python files and the actions declared therein will run in the environment that the Python file was declared to belong to in the static configuration.
No environment will be managed or loaded implicitly for actions that are
declared in the static configuration. Actions that need an environment must
declare the environment property.
Any shell commands will need to have their respective environments activated
as needed (e.g. by prefacing them with . .venv/bin/activate) even if they are
declared from Python code that runs in an environment. This is because shells
are not intrinsically aware of virtual environments.
Settings files
There is also support for declaring actions, environments and settings in TOML
files called Byggfile.toml. This is intended primarily for configuring static
settings like which virtual environment to use and their respective entrypoints,
but can also be used for declaring static actions. See
examples/taskrunner/Byggfile.toml and examples/environments/Byggfile.toml.
The evaluation order is TOML -> Python. Actions and settings declared later will override earlier ones.
Shell tab completions
Bygg has support for Bash and Zsh tab completions of arguments and entrypoint
actions. The completions will be loaded from the files that exist out of
Byggfile.toml and Byggfile.py, in that order.
Any environments declared in the static config files will be installed as needed and their respective Byggfiles will be evaluated to collect entrypoint actions.
To install completions, do:
bygg --completions
It will output a line that you can then add to .bashrc or .zshrc.
Don't forget to open a new shell instance after you've made changes to the settings files.
Note: if you reinstall Bygg with pipx or uv, the completions file will
probably have been removed, but the path to bygg will be the same. In this
case, just run the reinstalled bygg once (no arguments needed) to create the
completions file and then restart your shell. If the completions still don't
work, you might have to compare the output of bygg --completions with the
settings in the shell configuration file per above.
Notes
Manual steps
Add the following line to .bashrc or .zshrc:
eval "$(.your_bygg_venv/bin/register-python-argcomplete .your_bygg_venv/bin/bygg)"
Note for Zsh + argcomplete v2 users
The recommended setup above uses the argcomplete that is installed with Bygg, since this version (starting with v3) has proper support for Zsh so that the action completions will show descriptions. If you for whatever reason need to use a lower version of argcomplete you need to load the Bash compatibility layer first, and then the Bygg completions:
autoload -U bashcompinit ; bashcompinit
eval "$(register-python-argcomplete bygg)"
Getting a local copy
If you want to try out the examples or even develop Bygg itself, Bygg can be tried out and worked on without installing it globally:
First, clone this repo and cd into it, then execute the commands below.
If uv is installed (e.g. with pipx install uv),
it will be used by bootstrap.py and the Bygg examples where relevant.
This will speed up project setup and test running. If uv is not installed,
regular pip will be used.
# Create a virtual environment and install Bygg into it together with its dependencies:
./bootstrap.py
# Activate the virtual environment:
. .venv/bin/activate
# Optional: install and activate shell completions for this specific Bygg installation:
eval "$(bygg --completions)"
Now you can try out one of the examples:
cd examples/trivial
bygg transform
In the above, bygg is the command to execute bygg, and transform is an
action (much like a target in a Makefile). See examples/trivial/Byggfile.py
for details.
The target can be cleaned with
bygg transform --clean
Development
Running tests
With Bygg's virtual environment activated per above, tests can be run from the root directory:
pytest
With the virtual environment deactivated, the full test suite can be run with Nox. Nox should be installed outside of Bygg's virtual environment since it manages its own virtual environments:
pipx install nox
or
uv tool install nox
or
pip install --user --upgrade nox
After that, run tests with
nox
Metadata
Release files for bygg 0.12.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bygg-0.12.3.tar.gz | 80.7 kB | With provenance | Details for bygg-0.12.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bygg-0.12.3-py3-none-any.whl | Python 3 | none | any | Details for bygg-0.12.3-py3-none-any.whl |
Total release size: 129.2 kB
Release files / bygg-0.12.3.tar.gz
| Download URL | bygg-0.12.3.tar.gz |
|---|---|
| Size | 80.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3c98e82426049e5241fa25e40ce49dc7308bb1dde2ec57279376c7fbf18b4bc6
|
|
BLAKE2b-256 checksum How to use checksums |
cce87634cf6c14d6085186b70fd292a928cb8350f7a7a45a71c8684f06f256bf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 15, 2026.
Transparency logRelease files / bygg-0.12.3-py3-none-any.whl
| Download URL | bygg-0.12.3-py3-none-any.whl |
|---|---|
| Size | 48.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8055bff1710d103cbb38571ccc6863c63440b568850d174d063b3f8bdba38271
|
|
BLAKE2b-256 checksum How to use checksums |
b948e8aff8f3250addb43cbbd3d83be67a66bf8bdb8a8c23d1062899f8408a80
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 15, 2026.
Transparency logSecurity for bygg 0.12.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for bygg-0.12.3.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 15, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.