Pyrex development information and processes
Pyrex conforms to black for all Python code, and also makes use of flake8 as a linter. Please ensure all code conforms to this. There is helpful tool that will report any places where the code is non-conformant in the project root:
./lintIf you would like to tool to automatically reformat code to comply with PEP8,
pass the --reformat option:
./lint --reformat
Pyrex has a comprehensive test suite that can be used to test all generated images. Some external test data is required to perform the test. To download this data and prepare your sandbox for testing, run:
./ci/prepare.shOnce this is complete, the automated testing suite can be invoked with the command:
./ci/test.py -vbThe test suite uses Python unittest, so additional command line options are available.
The test suite will build all Pyrex image locally and run a set of tests
against them. If you would like to limit which images are tested, additional
arguments can be passed to filter the tests. Each image is tested using a test
class named PyrexImage_ENGINE_IMAGE where ENGINE is the container engine
(docker or podman) and IMAGE is the test image name will all non-word
characters replaced by _. For example, to test only the ubuntu-18.04-oe
image under docker, run:
./ci/test.py -vb PyrexImage_docker_ubuntu_18_04_oePyrex pulls prebuilt images from DockerHub by default, which should be
sufficient for most users. However, users that are active developing on Pyrex
or wish to build images locally instead of using published images can do so by
making the following changes to pyrex.ini:
-
Set
config:buildlocalto1 -
Change
config:pyrextagto an alternate tag instead of referencing the released version. While not strictly necessary, this step will help prevent confusion if you want to switch back to prebuilt images. If you choose not to change this, realize that your locally built images will overwrite your local container cache tags for the prebuilt images. As an example, you might add the following topyrex.ini:[config] pyrextag = my-image -
Set
imagebuild:buildcommandto adjust any of the build options (e.g. the path where the Dockerfile you wish to build is located). -
You may also want to set
imagebuild:quiettofalseif you want to see the images being built for debugging purposes
To make a release of Pyrex:
- Bump the
VERSIONin pyrex.py. Note that all versions should be of the formMAJOR.MINOR.MICRO+ an optional-*suffix. For example, the following are all valid versions:1.0.0,1.0.0-rc1. Stable releases intended for general consumption should always be in the formMAJOR.MINOR.MICROwithout any suffix. Push this change to the master branch. - Wait for the CI build
to finish and verify it passes, or manually test it with
./ci/test.py -vbf
- Create a new GitHub Release. The
release must be tagged with the version in
pyrex.py, prefixed withv. For example, the1.0.0release would be taggedv1.0.0 - Tagging the repository will trigger a new CI build. This build will
automatically push the container images to
ghcr using the
same tag that was created for the release. Verify that the
Release build
passes and the container images are pushed. In the unlikely event this
fails, delete the release, fix the issue, and try again. To manually deploy
a release, run:
./ci/deploy_docker.py all
At a minimum, releases should be made whenever changes are made to one of the Dockerfile image files. This ensure that users who are tracking the master branch of Pyrex (as opposed to sticking to a released tag) get the new container images.