Skip to main content

Builds a pythonic version number sbased on scm tags and branches

Project description

setup_scmversion

  • Master

    • Pipeline status
    • Coverage status
  • 0.0.1

    • Pipeline status
    • Coverage status

Builds a pythonic version number based on information available on your scm (tag, branch, and number of commits).

See LICENSE for important licensing information.

Instalation

Your setup.py will need jfaleiro.setup_scmversion to start - so you either make sure you have it pre-installed using pip:

pip install jfaleiro.setup_scmversion

or add this on the very top of your setup.py and forget about it moving forward.

try:
    import setup_scmversion
except ModuleNotFoundError as e:
    from pip._internal import main
    assert main('install jfaleiro.setup_scmversion'.split()) == 0

from setup_scmversion import version

You should add it to your setup_requires parameter in setup.py as well:

setup(
	...
    setup_requires=['jfaleiro.setup_scmversion'],
	...
)

Using

A pythonic version number is created from standard data available in your scm, i.e. tag, branch name, and number of differences from master:

setup(
	...
    version=version(),
	...
)

For example, release tags release/<version> with nnn differences from master will produce version <version>.dev<nnn> and a tagged version <tag> on master will produce the version <tag>. Everything else will produce master.dev<nnn> for master or no-version.dev<nnn> for any other branch.

You can also use a command line based shortcut to peek at the current version:

jfaleiro@itacoatiara:~/gitrepos/setup_scmversion (release/0.0.1 *+)$ scmversion 
0.0.1.dev1

Enjoy.

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

jfaleiro.setup_scmversion-0.0.1.tar.gz (3.8 kB view hashes)

Uploaded Source

Built Distribution

jfaleiro.setup_scmversion-0.0.1-py3-none-any.whl (17.5 kB view hashes)

Uploaded Python 3

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