Allow automatic builds in edit mode
Slowing down. Last release over 2 years ago, little activity since. Fine for existing code; think twice for a new project.
pip install runtime-builderRuntime Builder
Sometimes python developers want to include compiled output or other binary blob artifacts in their wheels. The source materials for this output is checked into git, but the blobs are not, since they're not source material and are at risk getting out of sync with the source distribution.
When building the wheel, the blobs need to be generated. But it may also be nice to rebuild the blobs if the source have changed at runtime to automate a step of the edit/test cycle.
This project lets you declare a single configuration describing how to build the artifacts, and build them at runtime during the development cycle or at wheel build time.
Example
There are example projects in tests/project_template_enscons and tests/project_template_setuptools.
tests/project_template_setuptools
├── README.md
├── proj
│ ├── bar.source
│ ├── foo.source
│ ├── run_test.py
│ └── runtime_build
├── pyproject.toml.template
├── setup.py
├── test_pip_install.sh
└── test_pip_install_editable.sh
This examples uses setuptools and setup.py to build. The setup.py and runtime_build files work together to make available artifacts built from the .source files.
project_template_enscons
├── README.md
├── SConstruct
├── proj
│ ├── bar.source
│ ├── foo.source
│ ├── run_test.py
│ └── runtime_build
├── pyproject.toml.template
├── test_pip_install.sh
└── test_pip_install_editable.sh
Note that this example uses enscons to build, as setuptools does not easily allow fine-grained control of the contents of the sdist and wheel files. In particular, this example takes pains to include the source files runtime_build, foo.source and bar.source in the sdist but not the wheel.
Configuration
Artifacts to be build must be declared in a runtime_build file located in the destination module of the artifacts. Each submodule can have zero or one of these build files. In the project_template example above, bar.source and foo.source each produce an output in the proj submodule, and runtime_build defines what the artifacts are.
This configuration file can be loaded at build time or at run time, so it cannot import anything that isn't made available in the build-system.requires section of pyproject.toml. In particular, it cannot import anything from the project being built since it has to be built before it can be installed in the build package, leading to a bootstrap problem.