feat: Configure NLP Utils Semantic Versioning with setuptools_scm and bumpversion

Configure setup.py to read version automatically
Update `bumpversion.cfg` versioning default commit msg template
Pull semantic version from setuptools_scm
Update documentation
This commit is contained in:
Emmanuel Awa 2019-08-01 18:22:50 +00:00
Родитель 85a6777835
Коммит cc1c00e2e8
4 изменённых файлов: 72 добавлений и 7 удалений

13
.bumpversion.cfg Normal file
Просмотреть файл

@ -0,0 +1,13 @@
[bumpversion]
current_version = 1.0.0
commit = True
tag = True
message = "Bump version: {current_version} -> {new_version}"
[bumpversion:file:setup.py]
search = version='{current_version}'
replace = version='{new_version}'
[bumpversion:file:utils_nlp/__init__.py]
search = __version__ = '{current_version}'
replace = __version__ = '{new_version}'

Просмотреть файл

@ -11,9 +11,6 @@ from os.path import basename, dirname, join, splitext
from setuptools import find_packages, setup
__version__ = "2019.08"
VERSION = __version__
def read(*names, **kwargs):
with io.open(
join(dirname(__file__), *names),
@ -24,7 +21,6 @@ def read(*names, **kwargs):
setup(
name="utils_nlp",
version=VERSION,
license="MIT License",
description="NLP Utility functions that are used for best practices in building state-of-the-art NLP methods and scenarios. Developed by Microsoft AI CAT",
long_description="%s\n%s"
@ -73,8 +69,9 @@ setup(
"Word Embedding",
],
python_requires=">=3.6",
install_requires=[],
install_requires=['setuptools_scm>=3.2.0',],
dependency_links=[],
extras_require={},
setup_requires=[],
use_scm_version=True,
setup_requires=['setuptools_scm'],
)

Просмотреть файл

@ -55,3 +55,53 @@ GloVe)
### [Interpreter](interpreter)
The interpreter submodule contains implementations to explain hidden states of models. It is a code implementation of the paper [Towards a Deep and Unified Understanding of Deep Neural Models in NLP](http://proceedings.mlr.press/v97/guan19a/guan19a.pdf).
### [Semantic Versioning](versioning)
This library is configured to use
[setuptools_scm](https://github.com/pypa/setuptools_scm/), following the
instructions there, to automatically get package version from git commit histories.
> NOTE: **There shouldn't be any references to manually coded versions**.
Verify what git tag to use by running:
```bash
python setup.py --version
```
It should look something like `0.1.0.dev4+gdfedba7.d20190209`
Using the information above the master branch, after a merge commit, can be _**Tagged**_ with the above semantic version `0.1.0` (ignoring the `dev4+gdfedba7.d20190209`)
For example:
git tag v0.1.0
Now verify the semantic version for the package:
python setup.py --version
All new merged commit on master must have a
[Semantic Versioning](https://semver.org/) release version with an
accompanying tag. TL;DR:
* `major.minor.patch`
* Patch is for bugfix
* Minor is for new features
* Major is for backwards-incompatible changes
* tags should be of the form `v0.1.2`
Installing this library into another clean git repository with a tag version, you should get a nice version like `0.2.1`.
However, if you inspect the `__version__` in this repo,
you'll get a nice **'dirty'** version number like `'0.2.1.dev0+g850a76d.d20180908'`.
This is useful for debugging, building sphinx docs in dev and so on.
You should never have to specify a version manually except just tagging your commit from the tag calculation generated by running
python setup.py --version

Просмотреть файл

@ -0,0 +1,5 @@
from setuptools_scm import get_version
# Determine semantic versioning automatically
# from git commits
__version__ = get_version()