CalVer
The calver-pinning package is a setuptools extension
for automatically defining your Python package version as a calendar version.
This is a fork of the original calver.
Usage
First, ensure calver-pinning 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-pinning"]
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-pinning'],
...
)
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-pinning'],
...
)
Release files for calver-pinning 2021.2.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| calver-pinning-2021.2.10.tar.gz | 7.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| calver_pinning-2021.2.10-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 15.0 kB
Release files / calver-pinning-2021.2.10.tar.gz
| Download URL | calver-pinning-2021.2.10.tar.gz |
|---|---|
| Size | 7.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5d8ab6d81328f9d02a73486d2a7da5c37fd08ff5994b0e019dcc319f94e0606c
|
|
BLAKE2b-256 checksum How to use checksums |
e8d2461e33b03701882fbf49a366db0579363738e501f13012d8fed65e695591
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.3.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5
|
Release files / calver_pinning-2021.2.10-py2.py3-none-any.whl
| Download URL | calver_pinning-2021.2.10-py2.py3-none-any.whl |
|---|---|
| Size | 7.7 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
c5545c03db0aac9f4a8ca268e0172c2f4a331d5ab8a017c66ff68ab9c7647201
|
|
BLAKE2b-256 checksum How to use checksums |
4467339a3d240bfc4d960d79bc85b6c7616a725be77929d22374cc37ed9a3ca9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.3.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5
|