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
# or alternatively
$ 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() # 1.10.3
version.next_minor() # 1.11.0
version.next_major() # 2.0.0
To bump to a new prerelease version:
from pep440_version_utils import Version
version = Version("1.10.2")
version.next_alpha() # 1.10.3a1
version.next_beta() # 1.10.3b1
version.next_release_candidate() # 1.10.3rc1
version.next_alpha("minor") # 1.11.0a1
version.next_beta("mior") # 1.11.0b1
version.next_release_candidate("major") # 2.0.0rc1
And it implements the full release cycle:
from pep440_version_utils import Version
version = Version("1.10.2")
alpha1 = version.next_alpha() # 1.10.3a1
alpha2 = alpha1.next_alpha() # 1.10.3a2
beta1 = alpha2.next_beta() # 1.10.3b1
rc1 = beta1.next_release_candidate() # 1.10.3rc1
rc2 = rc1.next_release_candidate() # 1.10.3rc2
new_version = rc2.next_micro() # 1.10.3
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 # True
Version("1.10.2b2").is_beta # True
Version("1.10.2rc1").is_release_candidate # True
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 buildpoetry publish
Metadata
Release files for pep440-version-utils 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pep440_version_utils-1.2.0.tar.gz | 4.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pep440_version_utils-1.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.4 kB
Release files / pep440_version_utils-1.2.0.tar.gz
| Download URL | pep440_version_utils-1.2.0.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9a663947b7323e75cda489ed7df0c7b6b4eb2d55ce9d123f2f81f89e66bb2c0d
|
|
BLAKE2b-256 checksum How to use checksums |
06795b894a33db703971ef6fa70804f6c5e3194425d67d1a13097c8c0963ccfc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.11.6 Darwin/24.6.0
|
Release files / pep440_version_utils-1.2.0-py3-none-any.whl
| Download URL | pep440_version_utils-1.2.0-py3-none-any.whl |
|---|---|
| Size | 5.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
35215cb9b799b2aef67e769936b3d99a38247e8c81fe90e6407b31d994b6a2a6
|
|
BLAKE2b-256 checksum How to use checksums |
ca5615da8dd21294d3e2a86e40299f76278ccf984625f63555cb6e9dba4eaac1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.11.6 Darwin/24.6.0
|