Skip to content

Package release

Erik Novak edited this page Aug 9, 2024 · 5 revisions

Automatic Release Pipeline

Changes made before GitHub release

On a local branch, do the following:

  1. Update the CHANGELOG file, reflecting the changes done between the current and new versions.
  2. increment the version of the package in anonipy/__init__.py. Make sure the increment is the same as the new release version.
  3. Push the changes on GitHub's main branch:
    git add CHANGELOG.md anonipy/__init__.py
    git commit -m "Increment version"
    git push

GitHub release

On GitHub, make a new release by:

  1. Go to Releases, found in the right metadata section
  2. Click Draft a new release
  3. Input a new tag in Choose a tag reflecting the changes:
    • Patch: if it contains bug fixes (ex: 1.2.3 → 1.2.4)
    • Minor: if it contains new non-breaking features (ex: 1.2.3 → 1.3.0)
    • Major: if it contains new breaking features (ex: 1.2.3 → 2.0.0)
  4. Click Generate release notes
  5. Check the release note
  6. Select Publish release

This will trigger GitHub Actions to create a new binary and publish the latest version to PyPI.

Manual Release Pipeline

Do this only if something goes wrong with the automatic pipeline.

Configuration

Make sure you have configured PyPI correctly (use of tokens, etc.).

Build package

To build the package, run:

# upgrade the build package
python -m pip install --upgrade build

# build the package
python -m build

Deploy package

Test PyPI

To deploy the package, run:

# upgrade the twine package
python -m pip install --upgrade twine

# deploy the package to testpypi
python -m twine upload --repository testpypi dist/*

Next, to test the package published on testpypi, run:

# install a virtual environment
python -m venv venv

# activate the environment
. ./venv/bin/activate

# install the package
pip install \
    --index-url https://test.pypi.org/simple/ \
    --extra-index-url https://pypi.org/simple/ \
    anonipy

This way, you can test the package without publishing it.

Production PyPI

Once the testing is done successfully, run the following commands:

# upgrade the twine package
python -m pip install --upgrade twine

# deploy the package to pypi
python -m twine upload dist/*