Skip to main content

Git and hg versioning for natcap projects

Project description

Consistent versioning for NatCap Projects

This package provides a consistent versioning scheme for projects of the Natural Capital Project (http://naturalcapitalproject.org).

Versioning Scheme

How a version string is formatted:

If we are at a tag:
    version = {tag}
else:
    version = {tag}.post{N}+r{nodeid|short}

If there are no tags:
    {tag} = 'null'

Examples:

  • Version string = 3.4.5

    • Meaning: This version of this tool was built from the tag 3.4.5.

    • You can update to this revision by calling hg update -r 3.4.5

  • Version string = 3.4.5.post35+r788a29c99234

    • Meaning: This version of this tool was built from a revision where:

      • The latest tag was 3.4.5

      • The latest commit on this branch is 35 commits beyond the latest tag.

      • The latest commit has a shortened node ID of 788a29c99234

    • You can update to this revision by calling hg update -r 788a29c99234

Installation

Via pip: pip install natcap.versioner

Via setup.py: python setup.py install

Dependencies

Both these can be installed via pip.

  • setuptools

  • yaml

To install dependencies:

pip install setuptools pyyaml

Usage In Your Project

To use this project, you’ll need to edit two files: setup.py and __init__.py.

In your ``setup.py``

Adding these lines to your setup.py allows the DVCS information to be fetched from git or hg and recorded in the package metadata.

from setuptools import setup
import natcap.versioner

setup(
    name='example_project',
    ...
    version=natcap.versioner.parse_version()
    natcap_version='example_project/version.py',
)

In your package’s ``__init__.py``

Adding these lines to your package’s __init__.py file will allow the package version to be fetched from the package metadata.

# Let's assume your package name is still 'example_project'
import natcap.versioner
__version__ = natcap.versioner.get_version('example_project')

Support

If something doesn’t work, it’s probably broken! Please submit an issue via the issue tracker, send James an email or stop by if you’re in the office and I’ll try to fix it!

0.2.4

  • Allowing get_version() to allow fallback to SCM only when allowed by user input. Defaults to only allowing fallback in non-frozen environments (e.g. a source tree). natcap.versioner.VersionNotFound will be raised if the version string cannot be loaded normally or SCM is disallowed.

  • If a version string cannot be parsed by vcs_version(), natcap.versioner.VersionNotFound will optionally be raised.

0.2.3

  • Turning setuptools zip_safe flag to False. When this and natcap.invest have their zip_safe flags all as False, the packages happily install side-by-side as individual eggs.

0.2.2

  • Fixes an issue where a development version is returned when the user is at a tag. The version is now correctly reported as just the tag.

0.2.1

  • Version files are now properly imported. This fixes an issue with users unable to fetch version strings from within frozen environments that are outside of a source tree.

0.2.0

  • API Change: version is now parsed from setup.py using natcap.versioner.parse_version().

  • Allowing the version to be correctly fetched from PKG-INFO from egg/distribution metadata even when the package has not already been built.

0.1.4

  • Attempting to get the utils module to import correctly.

0.1.3

  • Allowing version string to be written to a package file.

0.1.2

  • Default version scheme is dvcs-based post-release now. but can also do a pre-release.

0.1.1

  • Fixes installation issues where certain files needed for setup.py were missing from the source distribution.

0.1.0

  • Initial public release.

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

natcap.versioner-0.2.4.tar.gz (9.9 kB view details)

Uploaded Source

Built Distributions

natcap.versioner-0.2.4-py2.7.egg (16.7 kB view details)

Uploaded Source

natcap.versioner-0.2.4-py2-none-any.whl (13.5 kB view details)

Uploaded Python 2

File details

Details for the file natcap.versioner-0.2.4.tar.gz.

File metadata

File hashes

Hashes for natcap.versioner-0.2.4.tar.gz
Algorithm Hash digest
SHA256 bfbb013c411b8870dd912256183a33c0004acfff06a4980eaa0ed636503d7ab3
MD5 a32c066bb0c63ce2edbc4d1cbb40e83c
BLAKE2b-256 6cd9f7ac403eb2c41fb4d95905199709fead3cffc87d631d979be8b5f525052b

See more details on using hashes here.

File details

Details for the file natcap.versioner-0.2.4-py2.7.egg.

File metadata

File hashes

Hashes for natcap.versioner-0.2.4-py2.7.egg
Algorithm Hash digest
SHA256 122333affff6379952de78625969283b11963c602272d2bb73394c7e51ef6059
MD5 d1dccc64601273740fccc2ecf65a1c26
BLAKE2b-256 7ab6c720f1c650bc8c4a5f747a39062ec909f1976ba943d37afeef2162af03a2

See more details on using hashes here.

File details

Details for the file natcap.versioner-0.2.4-py2-none-any.whl.

File metadata

File hashes

Hashes for natcap.versioner-0.2.4-py2-none-any.whl
Algorithm Hash digest
SHA256 65142b396364a1a64e24928d3e47c4513106de33d99607d7086b8560d9ff057b
MD5 38a25f14e263339323614ee82077fe6e
BLAKE2b-256 ac7ac44789701eed7e781d55ec45b88fcea356ee08617681c86f30d7e0d8317a

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