Skip to main content

A set of plugins for setuptools_scm to enable better version tracking

Installation

pip install pygitversion

Usage

The usage is almost exactly the same as using setuptools_scm, so follow those guidelines. This package merely adds a couple of plugin functions to make the versioning a bit better (eg. having the branch name in the version if applicable).

To summarise: create a pyproject.toml and include (at least) the following lines:

# pyproject.toml
[build-system]
requires = ["setuptools>=30.3.0", "wheel", "setuptools_scm", "pygitversion"]

Then in your setup.py, add the following to the call to setup():

# setup.py
from setuptools import setup
from pygitversion import branch_scheme

setup(
    ...
    use_scm_version={
        "local_scheme": branch_scheme
    },
)

You can now print the version of the package simply by doing:

$ python setup.py --version

To set the version of your code, make your __init__.py have the following:

from pkg_resources import get_distribution, DistributionNotFound
try:
    __version__ = get_distribution(__name__).version
except DistributionNotFound:
    # package is not installed
    pass

And that’s it!

Development

To run the all tests run:

tox

Changelog

1.0.0

  • Move to setuptools_scm

0.1.0 (2019-09-04)

  • First release on PyPI.

Release files for pygitversion 1.0.1

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

Source distribution (sdist)

Source distribution for pygitversion 1.0.1
File Size Uploaded
pygitversion-1.0.1.tar.gz 7.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pygitversion 1.0.1
File Interpreter ABI Platform
pygitversion-1.0.1-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 11.8 kB

Release files / pygitversion-1.0.1.tar.gz

Download URL pygitversion-1.0.1.tar.gz
Size 7.4 kB
Tags Source
SHA-256 checksum
How to use checksums
66dac471843ff84b5184d3a12222107dda4b6d16854394de46c7a5e43f3448be
BLAKE2b-256 checksum
How to use checksums
89c99a1f8f9216311aedc0b7ccbd2eea4b0590e30700c3f74f7d2a59ccf485ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.7.4

Release files / pygitversion-1.0.1-py2.py3-none-any.whl

Download URL pygitversion-1.0.1-py2.py3-none-any.whl
Size 4.4 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
6a6fb9716c658502d6be84ab42d4421f293ca4c780e004001dbf23960fcc5ada
BLAKE2b-256 checksum
How to use checksums
56462e741d30392e4e5ab3e29db51eb09414bd18a96e0147533a9349f2b95a1b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.7.4

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

0.1.7

1 release file

0.1.6

1 release file

0.1.5

1 release file

0.1.4

1 release file

0.1.2

1 release file

0.1.1

2 release files

0.1.0

1 release file

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