Skip to main content

Utilities to deal with pep440 versioning

Project description

Continuous Integration Coverage Status

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.

Release cycle

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, dev and local versions yet. Contributions are welcome 😊

How to contribute

This package is fairly simple, here is how you can contribute:

  1. ⚙️ Install poetry
  2. 📦 In the repository folder, run poetry install
  3. ✍️ Implement the desired changes
  4. ✅ 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
  1. ➡️ Submit a new pull request

Do not hesitate to contribue, even for very small changes!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pep440-version-utils-0.2.0.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

pep440_version_utils-0.2.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file pep440-version-utils-0.2.0.tar.gz.

File metadata

  • Download URL: pep440-version-utils-0.2.0.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.3 CPython/3.7.7 Darwin/19.4.0

File hashes

Hashes for pep440-version-utils-0.2.0.tar.gz
Algorithm Hash digest
SHA256 82483b8fa3458c30efd58946fde25b85fb2e55d286e52c5329adb8411d863845
MD5 fd9af5523f1b76a90105b1b405d6b0de
BLAKE2b-256 5696c8a59050416a640a52611ece9f468d9df6c9169a14a9ada0470ffdd81455

See more details on using hashes here.

File details

Details for the file pep440_version_utils-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pep440_version_utils-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 34b8dc9b476edd75cd4a75d08d4d241f6c84b2f21fcb0315a852e858080ff3d9
MD5 0ffbde3ba06d6e10605ab5f9fc9ba7ea
BLAKE2b-256 cc4b93d61b26f507c4085c3571ac3cc0a4907f8be0a8c9943aa8550b30a17243

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page