
pep440-version-utils
This package regroups utilities to deal with pep440 versioning. It is based on the
PyPA's packaging
project and extends it.
It makes it easier to handle version bumps and strictly follows PEP440 specification.

Installation
Use pip
or poetry
to install this package:
$ pip install pep440-version-utils
$ poetry add pep440-version-utils
Usage
Since this package extends the packaging
library, so it supports version parsing and ordering as described
in this documentation.
To bump to a new release version:
from pep440_version_utils import Version
version = Version("1.10.2")
version.next_micro()
version.next_minor()
version.next_major()
To bump to a new prerelease version:
from pep440_version_utils import Version
version = Version("1.10.2")
version.next_alpha()
version.next_beta()
version.next_release_candidate()
version.next_alpha("minor")
version.next_beta("mior")
version.next_release_candidate("major")
And it implements the full release cycle:
from pep440_version_utils import Version
version = Version("1.10.2")
alpha1 = version.next_alpha()
alpha2 = alpha1.next_alpha()
beta1 = alpha2.next_beta()
rc1 = beta1.next_release_candidate()
rc2 = rc1.next_release_candidate()
new_version = rc2.next_micro()
You can also check if a version is a specific type of prerelease:
from pep440_version_utils import Version
Version("1.10.2a1").is_alpha
Version("1.10.2b2").is_beta
Version("1.10.2rc1").is_release_candidate
Limitations
This package doesn't support post and local versions yet. Contributions are welcome 😊
How to contribute
This package is fairly simple, here is how you can contribute:
- ⚙️ Install
poetry
- 📦 In the repository folder, run
poetry install
- ✍️ Implement the desired changes
- ✅ Run test, type checking and code quality checks:
$ poetry run black . --check
$ poetry run mypy */**.py --ignore-missing-imports
$ poetry run pytest --cov=pep440_version_utils
- ➡️ Submit a new pull request
Do not hesitate to contribue, even for very small changes!
How to release new versions
- Update CHANGELOG
- Update project version in
pyproject.toml
poetry build
poetry publish