Skip to main content

Version discovery for Python packages

Project description

DiscoverVersion

This package automatically discover version information for a package. It tries the following option to get the version of the package:

  • Inspect a PKG-INFO file
  • Ask git, if the current directory is a git-repository
  • Ask importlib.metadata

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


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.2.2.tar.gz (3.4 kB view details)

Uploaded Source

File details

Details for the file discoverversion-0.2.2.tar.gz.

File metadata

  • Download URL: discoverversion-0.2.2.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for discoverversion-0.2.2.tar.gz
Algorithm Hash digest
SHA256 f0deddff2e8c0d5606440d1a2f79eafc5192be5ac4293eeb250dc868d91a05b9
MD5 fca3f35e51348cf856a07bee4eb5ba3e
BLAKE2b-256 5d7dc60099eb430dcfd05b5a298392e2997e20f7c3c1f70a89c0da5e0b3e26af

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page