Version discovery for Python packages
Project description
DiscoverVersion
This package automatically discover version information for a package. It
first asks git
, and if that fails tries to get the version from package
metadata throught importlib
. It is intended as a lightweight replacement for
setuptools_scm
.
Usage
To use automatic version discovery with your build system of choice
, here flit
, add the following lines to your
pyproject.toml
:
[build-system]
requires = ["flit_core>=3.2", "DiscoverVersion"]
build-backend = "flit_core.buildapi"
[project]
dynamic = ['version']
dependencies = ['DiscoverVersion']
The add the following to your toplevel __init__.py
:
from DiscoverVersion import get_version
__version__ = get_version('my_package_name')
Note that it is important to hard code the name of your package in the call
to get_version
.
Tests
Before being able to run tests, you need to execute
pip install -e .[test]
to editably install the code.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
discoverversion-0.1.6.tar.gz
(3.1 kB
view hashes)