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", "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(tz=datetime.timezone.utc).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 the current date/time by passing the environment variable
SOURCE_DATE_EPOCH, which should be a Unix timestamp in seconds.
This is useful for reproducible builds (see https://reproducible-builds.org/docs/source-date-epoch/):
env SOURCE_DATE_EPOCH=1743428011000 python setup.py --version
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(tz=datetime.timezone.utc)
return now.strftime("%Y").zfill(5) + "." + now.strftime("%m.%d")
setup(
...
use_calver=long_now_version,
setup_requires=['calver'],
...
)
Metadata
Release files for calver 2025.10.20
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| calver-2025.10.20.tar.gz | 8.1 kB | With provenance | Details for calver-2025.10.20.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| calver-2025.10.20-py3-none-any.whl | Python 3 | none | any | Details for calver-2025.10.20-py3-none-any.whl |
Total release size: 15.5 kB
Release files / calver-2025.10.20.tar.gz
| Download URL | calver-2025.10.20.tar.gz |
|---|---|
| Size | 8.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c98b376c2424642224d456b2f70c51402343e008c63d204634665e1a2a2835f5
|
|
BLAKE2b-256 checksum How to use checksums |
4a960c57e3e228ffc54074867406b659b197678674f1f0bf600d114965289834
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 20, 2025.
Transparency logRelease files / calver-2025.10.20-py3-none-any.whl
| Download URL | calver-2025.10.20-py3-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d7d75224eed9d9263f4fb30008487615196d208d14752bfd93fea7af2c84f508
|
|
BLAKE2b-256 checksum How to use checksums |
08cc31996b2bd918698888b443da1dea201c338643224539c1be4b2d76c9353c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 20, 2025.
Transparency logSecurity for calver 2025.10.20
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for calver-2025.10.20.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 20, 2025.
Transparency logA 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.