https://github.com/changaco/version.py
Automatic version numbers for git-based python projects
https://github.com/changaco/version.py
python
Last synced: 11 months ago
JSON representation
Automatic version numbers for git-based python projects
- Host: GitHub
- URL: https://github.com/changaco/version.py
- Owner: Changaco
- Created: 2015-11-24T09:40:47.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2022-01-30T09:20:23.000Z (over 4 years ago)
- Last Synced: 2025-05-15T01:37:18.044Z (about 1 year ago)
- Topics: python
- Language: Python
- Homepage:
- Size: 8.79 KB
- Stars: 98
- Watchers: 1
- Forks: 9
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
`version.py` saves you from having to hard-code the version number of your
project by getting it from git tags (directly or indirectly).
To use the script, simply copy it into your project and call `get_version()`
in your `setup.py` file:
from version import get_version
setup(
...
version=get_version(),
...
)
By default the tags that are considered to be version numbers are those that
start with a digit. If you use a prefix, for example a `v`, modify the `PREFIX`
constant in `version.py` accordingly.
You need to distribute the `version.py` file in your sdist packages
by adding the following line in the `MANIFEST.in` file:
include version.py
For the script to work within git archives (for example those automatically
generated by GitHub for each tag) you need to add the following line to the
`.gitattributes` file:
version.py export-subst
---
Note: if you don't care about git archives, or you're looking for a solution
that works with Mercurial, then you can use [setuptools_scm][setuptools_scm]
instead.
[setuptools_scm]: https://pypi.python.org/pypi/setuptools_scm
---
Compatibility: python 3.x and 2.7
Licence: [CC0 Public Domain Dedication](http://creativecommons.org/publicdomain/zero/1.0/)