katversion
The katversion package provides proper versioning for Python packages as dictated by their (git) source repositories. The resulting version string is baked into the installed package’s __init__.py file for guaranteed traceability when imported (no dependency on what pkg_resources or importlib thinks!).
Version String Format
katversion generates a version string for your SCM package that complies with PEP 440. It only supports git repositories.
The format of our version string is:
- for RELEASE builds:
<major>.<minor>
e.g.
0.1
2.4
- for DEVELOPMENT builds:
<major>.<minor>.dev<num_commits>+<branch_name>.g<short_git_sha>[.dirty]
e.g.
0.2.dev34+new.shiny.feature.gfa973da
2.5.dev7+master.gb91ffa6.dirty
- for UNKNOWN builds:
0.0+unknown.[<scm_type>.]<timestamp>
e.g.
0.0+unknown.git.201402031023
0.0+unknown.201602081715
where <major>.<minor> is derived from the latest version tag and
<num_commits> is the total number of commits on the development branch.
The <major>.<minor> substring for development builds will be that of the
NEXT (minor) release, in order to allow proper Python version ordering.
To add a version tag use the `git tag` command, e.g.
$ git tag -a 1.2 -m 'Release version 1.2'
Typical Usage
Add this to setup.py (handles installed packages):
from setuptools import setup
setup(
...,
# version=1.0, # remove the version parameter as it will be overridden
setup_requires=['katversion'],
use_katversion=True,
...
)
Add this to mypackage/__init__.py, including the comment lines (handles local packages):
# BEGIN VERSION CHECK
# Get package version when locally imported from repo or via -e develop install
try:
import katversion as _katversion
except ImportError: # pragma: no cover
import time as _time
__version__ = "0.0+unknown.{}".format(_time.strftime('%Y%m%d%H%M'))
else: # pragma: no cover
__version__ = _katversion.get_version(__path__[0])
# END VERSION CHECK
In addition, a command-line script for checking the version:
# From inside your SCM subdirectory, run the following command # which will print the result to stdout: $ kat-get-version.py
Metadata
Release files for katversion 1.3
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 |
|---|---|---|---|---|
| katversion-1.3.tar.gz | 11.7 kB | Without provenance | Details for katversion-1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| katversion-1.3-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for katversion-1.3-py2.py3-none-any.whl |
Total release size: 23.8 kB
Release files / katversion-1.3.tar.gz
| Download URL | katversion-1.3.tar.gz |
|---|---|
| Size | 11.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
96f607d7bcae49cb6d0306d53616b9aaa096b72896af0eb8e2929f3cf829244c
|
|
BLAKE2b-256 checksum How to use checksums |
e8e8d5e814ab2c73e05c2feba29ad568348f1c2e7bc934ee68372c65f6f653f0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.3
|
Release files / katversion-1.3-py2.py3-none-any.whl
| Download URL | katversion-1.3-py2.py3-none-any.whl |
|---|---|
| Size | 12.1 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
c83453fc0bb69be2fdc428fd63ad0250545dc6f5e55fc836f066516762a5594c
|
|
BLAKE2b-256 checksum How to use checksums |
7b428828a066df83904a71c9ab0034feb9a2f5b4ca533eb9b4488bf0d1bf2b9a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.3
|
Security for katversion 1.3
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.