Skip to content

Commit

Permalink
[MRG] use setuptools_scm for version management (#471)
Browse files Browse the repository at this point in the history
* Use setuptools_scm for versioning

- add setuptools_scm_git_archive support
- update release docs

* update setuptools_scm

* fix variable name
  • Loading branch information
luizirber authored and ctb committed Dec 15, 2018
1 parent 4aab62f commit 5b33517
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 14 deletions.
1 change: 1 addition & 0 deletions .git_archival.txt
@@ -0,0 +1 @@
ref-names: $Format:%D$
1 change: 1 addition & 0 deletions .gitattributes
@@ -0,0 +1 @@
.git_archival.txt export-subst
5 changes: 5 additions & 0 deletions .gitignore
Expand Up @@ -19,3 +19,8 @@ _minhash.so
.coverage
sourmash_lib/_minhash.cpp
sourmash/_minhash.cpp
.asv/
.eggs/
.pytest_cache
.python-version
sourmash/version.py
3 changes: 3 additions & 0 deletions Makefile
Expand Up @@ -35,4 +35,7 @@ wheel:
docker pull $${DOCKER_IMAGE} ; \
docker run --rm -v `pwd`:/io $${DOCKER_IMAGE} /io/travis/build-wheels.sh

last-tag:
git fetch -p -q; git tag -l | sort -V | tail -1

FORCE:
4 changes: 2 additions & 2 deletions doc/release.md
Expand Up @@ -27,7 +27,7 @@ cd sourmash
and then tag the release candidate with the new version number prefixed by
the letter 'v':
```
git tag v${new_version}-${rc}
git tag -a v${new_version}-${rc}
git push --tags git@github.com:dib-lab/sourmash.git
```
3\. Test the release candidate. Bonus: repeat on Mac OS X:
Expand Down Expand Up @@ -116,7 +116,7 @@ so:
authorized account):
```
cd ../sourmash
git tag v${new_version}
git tag -a v${new_version}
python setup.py register sdist upload
```
2\. Delete the release candidate tag and push the tag updates to GitHub:
Expand Down
10 changes: 3 additions & 7 deletions setup.py
Expand Up @@ -4,11 +4,6 @@
from setuptools import Extension
import os

# retrieve VERSION from sourmash/VERSION.
thisdir = os.path.dirname(__file__)
version_file = open(os.path.join(thisdir, 'sourmash', 'VERSION'))
VERSION = version_file.read().strip()

EXTRA_COMPILE_ARGS = ['-std=c++11', '-pedantic']
EXTRA_LINK_ARGS=[]

Expand Down Expand Up @@ -48,7 +43,6 @@
SETUP_METADATA = \
{
"name": "sourmash",
"version": VERSION,
"description": "tools for comparing DNA sequences with MinHash sketches",
"long_description": LONG_DESCRIPTION,
"long_description_content_type": "text/markdown",
Expand All @@ -71,7 +65,9 @@
extra_compile_args=EXTRA_COMPILE_ARGS,
extra_link_args=EXTRA_LINK_ARGS)],
"install_requires": ["screed>=0.9", "ijson", "khmer>=2.1"],
"setup_requires": ['Cython>=0.25.2', "setuptools>=38.6.0"],
"setup_requires": ['Cython>=0.25.2', "setuptools>=38.6.0",
'setuptools_scm', 'setuptools_scm_git_archive'],
"use_scm_version": {"write_to": "sourmash/version.py"},
"extras_require": {
'test' : ['pytest', 'pytest-cov', 'numpy', 'matplotlib', 'scipy','recommonmark'],
'demo' : ['jupyter', 'jupyter_client', 'ipython'],
Expand Down
1 change: 0 additions & 1 deletion sourmash/VERSION

This file was deleted.

16 changes: 12 additions & 4 deletions sourmash/__init__.py
Expand Up @@ -20,7 +20,15 @@
from . import sbt_storage
from . import signature

# retrieve VERSION from sourmash/VERSION.
thisdir = os.path.dirname(__file__)
version_file = open(os.path.join(thisdir, 'VERSION'))
VERSION = version_file.read().strip()
from pkg_resources import get_distribution, DistributionNotFound
try:
VERSION = get_distribution(__name__).version
except DistributionNotFound: # pragma: no cover
try:
from .version import version as VERSION # noqa
except ImportError: # pragma: no cover
raise ImportError(
"Failed to find (autogenerated) version.py. "
"This might be because you are installing from GitHub's tarballs, "
"use the PyPI ones."
)

0 comments on commit 5b33517

Please sign in to comment.