Skip to main content

CalVer

The calver package is a setuptools extension for automatically defining your Python package version as a calendar version.

Usage

First, ensure calver is present during the project's build step by specifying it as one of the build requirements:

pyproject.toml:

[build-system]
requires = ["setuptools>=42", "wheel", "calver"]

To enable generating the version automatically based on the date, add the following to setup.py:

setup.py:

from setuptools import setup

setup(
    ...
    use_calver=True,
    setup_requires=['calver'],
    ...
)

You can test that it is working with:

$ python setup.py --version
2020.6.16

Configuration

By default, when setting use_calver=True, it uses the following to generate the version string:

>>> import datetime
>>> datetime.datetime.now().strftime("%Y.%m.%d")
2020.6.16

You can override the format string by passing it instead of True:

setup.py:

from setuptools import setup

setup(
    ...
    use_calver="%Y.%m.%d.%H.%M",
    setup_requires=['calver'],
    ...
)

You can override this entirely by passing a callable instead, which will be called with no arguments at build time:

setup.py:

import datetime
from setuptools import setup

def long_now_version():
    now = datetime.datetime.now()
    return now.strftime("%Y").zfill(5) + "." + now.strftime("%m.%d")

setup(
    ...
    use_calver=long_now_version,
    setup_requires=['calver'],
    ...
)

Metadata

Release files for calver 2021.7.30

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for calver 2021.7.30
File Size Uploaded Provenance Actions
calver-2021.7.30.tar.gz 7.7 kB Without provenance Details for calver-2021.7.30.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for calver 2021.7.30
File Interpreter ABI Platform Actions
calver-2021.7.30-py3-none-any.whl Python 3 none any Details for calver-2021.7.30-py3-none-any.whl

Total release size: 14.7 kB

Release files / calver-2021.7.30.tar.gz

Download URL calver-2021.7.30.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
96e87452ccc8e169b95bdda643818aa0b46f1d469785452cb37cd0292f1b0b72
BLAKE2b-256 checksum
How to use checksums
ce1460551287487e2e4afe2a890049ba3d5785cd17af73eda6458b7e547eeef5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.5.0.1 requests/2.23.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

Release files / calver-2021.7.30-py3-none-any.whl

Download URL calver-2021.7.30-py3-none-any.whl
Size 7.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
da4bb7817d6205a8e3196d8c848f352d85990bbd33482e8e70f8104fcce1fe46
BLAKE2b-256 checksum
How to use checksums
0a5ef2c317e0a4ca42d6fca625b535d586477e625fd13c2512de7a08e91cc4be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.5.0.1 requests/2.23.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

Security for calver 2021.7.30

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page