Build and Release#
Local package building for CLI testing#
To build the package locally for testing especially for the cli interface, use the following steps:
Ensure that you have activated a virtual environment where you would like libera-utils to be installed.
run
python -m pip install .
from the root of the repository.You should now be able to run the
libera-utils --version
command from the command line as see that the version number matches the one inpyproject.toml
.
Release Process#
Atlassian Git Workflow Reference:
Create a release candidate branch named according to the version to be released. This branch is used to polish the release while work continues on dev (towards the next release). The naming convention is
release/X.Y.Z
Bump the version of the package to the version you are about to release, either manually by editing
pyproject.toml
or by runningpoetry version X.Y.Z
or bumping according to a valid bump rule likepoetry version patch
(see poetry docs).Open a PR to merge the release branch into main. This informs the rest of the team how the release process is progressing as you polish the release branch.
When you are satisfied that the release branch is ready, merge the PR into
main
. This should be a purely “fast-forward” merge. Do not delete the release branch when merging as you will need it later.Check out the
main
branch, pull the merged changes, and tag the newly created merge commit with the desired versionX.Y.Z
and push the tag upstream.git tag -a X.Y.Z -m "version release X.Y.Z" git push origin X.Y.Z
Checkout the tag you just created (ensures the correct version is recorded in the build artifacts) and build the package (see below). Check that the version of the built artifacts is as you expect (should match the version git tag).
Optionally distribute the artifacts to PyPI/Nexus if desired (see below).
Open a PR to merge
release/X.Y.Z
back intodev
so that any changes made during the release process are also captured indev
. This should be a purely “fast-forward” merge.
Building and Distribution to Public PyPI#
Ensure that
poetry
is installed by runningpoetry --version
.Checkout the tag of the version you are releasing.
To build the distribution archives, run
poetry build
.To upload the wheel to PyPI, first set your environment variables with the API token for the correct PyPI account:
export PYPI_USERNAME=__token__ export PYPI_TOKEN=<Your API Token>
Then run
poetry publish --username $PYPI_USERNAME --password $PYPI_TOKEN
. You will need the account information for theliberasdc
PyPI account.