From e6522a5234ce7db2f5b209068aac960ebc07b214 Mon Sep 17 00:00:00 2001 From: Alastair Porter Date: Wed, 6 May 2020 14:35:28 +0200 Subject: [PATCH 1/2] Add some notes about how to push a git tag --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index d58276e..23a52d7 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,12 @@ For this project we are using [semantic versioning](http://semver.org/). If you want to make a new release: 1. Create a new tag in git using the following format: `v..`. + + git tag v1.x.0 + git push --tags + 2. Create a release on GitHub based on that tag. Specify changes that were made. + https://github.com/metabrainz/brainzutils-python/releases/new When updating underlying dependencies keep in mind breaking changes that they might have. Update version of `brainzutils-python` accordingly. From f0cbae2e12099efa27d8487cfdc62d6a875c88c5 Mon Sep 17 00:00:00 2001 From: Alastair Porter Date: Wed, 6 May 2020 14:41:10 +0200 Subject: [PATCH 2/2] Use setuptools_scm to get the version from the git tag --- brainzutils/__init__.py | 8 +++++++- setup.py | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/brainzutils/__init__.py b/brainzutils/__init__.py index c162747..6aa2012 100644 --- a/brainzutils/__init__.py +++ b/brainzutils/__init__.py @@ -1 +1,7 @@ -__version__ = '1.14.1' +from pkg_resources import get_distribution, DistributionNotFound + +try: + __version__ = get_distribution(__name__).version +except DistributionNotFound: + # package is not installed + pass diff --git a/setup.py b/setup.py index 37bbbd9..7628b60 100644 --- a/setup.py +++ b/setup.py @@ -1,15 +1,15 @@ #!/usr/bin/env python from setuptools import setup, find_packages -from brainzutils import __version__ setup( name="brainzutils", - version=__version__, description="Python tools for MetaBrainz projects", author="MetaBrainz Foundation", author_email="support@metabrainz.org", py_modules=["brainzutils"], packages=find_packages(), + use_scm_version=True, + setup_requires=['setuptools_scm'], install_requires=open("requirements.txt").read().split(), )