Skip to main content

Intelligent auto-versioning.

Project description

v2 provides for auto-versioning in an intuitive way.


from v2 import v2

      # ...
      # ...
      setup_requires=[..., 'v2', ...],
      install_requires=[..., 'v2', ...],   # Necessary only when using
                                           # from your package root as
                                           # shown below.

From within your package root:

from v2 import v2

__version__ = v2.from_pkg().from_git().from_default().version

From within your Sphinx

sys.path.insert(0, os.path.abspath('../..'))

from v2 import v2

# ...

version = v2.from_file('../../VERSION').from_git().version

By default, v2 looks for and writes to VERSION in the project root. It is also generally necessary to bundle v2 with your package. (Sadly.) Consequently, a two-line is necessary:

include VERSION

When you pip install v2, it makes available the v2 command line tool, which provides the module and the for you.

:;  v2
18:48:51.284 Writing local copy of v2 to
18:48:51.285 Appending and VERSION to


v2 allows you to control the order in which versions are found, simply by call from_file, from_git and from_pkg in the desired order. The first one found is used; remaining searches are skipped. To obtain the version value we use .version (it’s always a string).

Writing the Version

The v2 module’s default interface object uses VERSION as the path to its version file. With .from_file it reads from this file, if present; with .imprint it writes to this file.

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

v2-1.0.6.tar.gz (3.7 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page