Skip to main content

"A small library that versions your Python projects."

Project description

gha pypi coverage

Incremental is a small library that versions your Python projects.

API documentation can be found here.

Quick Start

Add this to your setup.py‘s setup() call, removing any other versioning arguments:

setup(
    use_incremental=True,
    setup_requires=['incremental'],
    install_requires=['incremental'], # along with any other install dependencies
    ...
}

Install Incremental to your local environment with pip install incremental[scripts]. Then run python -m incremental.update <projectname> --create. It will create a file in your package named _version.py and look like this:

from incremental import Version

__version__ = Version("widgetbox", 17, 1, 0)
__all__ = ["__version__"]

Then, so users of your project can find your version, in your root package’s __init__.py add:

from ._version import __version__

Subsequent installations of your project will then use Incremental for versioning.

Incremental Versions

incremental.Version is a class that represents a version of a given project. It is made up of the following elements (which are given during instantiation):

  • package (required), the name of the package this Version represents.

  • major, minor, micro (all required), the X.Y.Z of your project’s Version.

  • release_candidate (optional), set to 0 or higher to mark this Version being of a release candidate (also sometimes called a “prerelease”).

  • post (optional), set to 0 or higher to mark this Version as a postrelease.

  • dev (optional), set to 0 or higher to mark this Version as a development release.

You can extract a PEP-440 compatible version string by using the .public() method, which returns a str containing the full version. This is the version you should provide to users, or publicly use. An example output would be "13.2.0", "17.1.2dev1", or "18.8.0rc2".

Calling repr() with a Version will give a Python-source-code representation of it, and calling str() with a Version will provide a string similar to '[Incremental, version 16.10.1]'.

Updating

Incremental includes a tool to automate updating your Incremental-using project’s version called incremental.update. It updates the _version.py file and automatically updates some uses of Incremental versions from an indeterminate version to the current one. It requires click from PyPI.

python -m incremental.update <projectname> will perform updates on that package. The commands that can be given after that will determine what the next version is.

  • --newversion=<version>, to set the project version to a fully-specified version (like 1.2.3, or 17.1.0dev1).

  • --rc, to set the project version to <year-2000>.<month>.0rc1 if the current version is not a release candidate, or bump the release candidate number by 1 if it is.

  • --dev, to set the project development release number to 0 if it is not a development release, or bump the development release number by 1 if it is.

  • --patch, to increment the patch number of the release. This will also reset the release candidate number, pass --rc at the same time to increment the patch number and make it a release candidate.

  • --post, to set the project postrelease number to 0 if it is not a postrelease, or bump the postrelease number by 1 if it is. This will also reset the release candidate and development release numbers.

If you give no arguments, it will strip the release candidate number, making it a “full release”.

Incremental supports “indeterminate” versions, as a stand-in for the next “full” version. This can be used when the version which will be displayed to the end-user is unknown (for example “introduced in” or “deprecated in”). Incremental supports the following indeterminate versions:

  • Version("<projectname>", "NEXT", 0, 0)

  • <projectname> NEXT

When you run python -m incremental.update <projectname> --rc, these will be updated to real versions (assuming the target final version is 17.1.0):

  • Version("<projectname>", 17, 1, 0, release_candidate=1)

  • <projectname> 17.1.0rc1

Once the final version is made, it will become:

  • Version("<projectname>", 17, 1, 0)

  • <projectname> 17.1.0

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

incremental-22.10.0rc1.tar.gz (18.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

incremental-22.10.0rc1-py2.py3-none-any.whl (16.4 kB view details)

Uploaded Python 2Python 3

File details

Details for the file incremental-22.10.0rc1.tar.gz.

File metadata

  • Download URL: incremental-22.10.0rc1.tar.gz
  • Upload date:
  • Size: 18.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.7

File hashes

Hashes for incremental-22.10.0rc1.tar.gz
Algorithm Hash digest
SHA256 ac428f45a6ffab3517af5737e87ec74f878715e59641ff0d5a07c1fdc3a2c5a2
MD5 f02829baa9f08e278546880b46f7df45
BLAKE2b-256 512cbcfdca038a62182253745545098fa846495f5a16f25a9c0821b707217569

See more details on using hashes here.

File details

Details for the file incremental-22.10.0rc1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for incremental-22.10.0rc1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 0c2628cc71b81fd011a8e7385e5bf44d64eebe6a1940af0cc99bcc8ed8221c9e
MD5 0e5b5ca8acc162f21a7e7ae628024c10
BLAKE2b-256 5745adb9659cd3e47d55dad9bf2be35ff19d6eb55463bd2e4bcb0136f8abecf2

See more details on using hashes here.

Supported by

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