Before creating a new release carefully consider the version number of the new release. We are following Semantic Versioning and PEP440.
-
Install twine for pypi package uploads
python3 -m pip install --user --upgrade twine
Note: This is only necessary for users performing the release process for the first time.
-
Create an account at Test PyPI.
-
Create an account at PyPI.
-
Create a pypi configuration file
~/.pypirc
with the following content (Note:<username>
must be replaced):[distutils] index-servers = pypi testpypi [pypi] username = <username> [testpypi] repository = https://test.pypi.org/legacy/ username = <username>
-
Fetch upstream changes and create a branch:
git fetch upstream git checkout -b create-new-release upstream/main
-
Get the current version number
poetry run python -m pontos.version show
-
Update the version number to some alpha version e.g.
poetry run python -m pontos.version update 1.2.3a1
-
Create a source and wheel distribution:
rm -rf dist build ospd.egg-info poetry build
-
Upload the archives in
dist
to Test PyPI:twine upload -r testpypi dist/*
-
Check if the package is available at https://test.pypi.org/project/ospd.
-
Create a test directory:
mkdir ospd-install-test cd ospd-install-test python3 -m venv test-env source test-env/bin/activate pip install -U pip # ensure the environment uses a recent version of pip pip install --pre -I --extra-index-url https://test.pypi.org/simple/ ospd
-
Check install version with a Python script:
python3 -c "from ospd import __version__; print(__version__)"
-
Remove test environment:
deactivate cd .. rm -rf ospd-install-test
-
Determine new release version number
If the output is something like
1.2.3.dev1
or1.2.3a1
, the new version should be1.2.3
. -
Update to new version number (
<new-version>
must be replaced by the version from the last step)cd path/to/git/clone/of/ospd poetry run python -m pontos.version update <new-version>
-
Update the
CHANGELOG.md
file:- Change
[unreleased]
to new release version. - Add a release date.
- Update reference to Github diff.
- Remove empty sub sections like Deprecated.
- Change
-
Create a git commit:
git add . git commit -m "Prepare release <version>"
-
Create a pull request (PR) for the earlier commit:
git push origin
Open GitHub and create a PR against https://github.com/greenbone/ospd.
-
Ask another developer/maintainer to review and merge the PR.
-
Once the PR is merged, update the local
main
branch:git fetch upstream git rebase upstream/main main
-
Create a git tag:
git tag v<version>
Or even a tag signed with a personal GPG key:
git tag --sign --message "Tagging the <version> release" v<version>
-
Push changes and tag to Github:
git push --tags upstream
-
Uploading to PyPI is done automatically by pushing a git tag via CircleCI
-
Check if new version is available at https://pypi.org/project/ospd.
-
Update to a Development Version
The next version should contain an incremented minor version and a dev suffix e.g. 2.3.0.dev1
poetry run python -m pontos.version update <next-dev-version>
-
Create a commit for the version bump:
git add . git commit -m "Update version after <version> release" git push upstream
-
Create a Github release: