Use setuptools_scm to simplify versioning during release

This commit is contained in:
Hugo 2019-12-27 23:13:58 +02:00
parent 364f72f827
commit ad2f9cbaa2
5 changed files with 30 additions and 47 deletions

View file

@ -1,5 +0,0 @@
graft src
include setup.py
include README.md
include COPYING
recursive-include tests *.py

View file

@ -1,40 +1,30 @@
# Release Checklist # Release Checklist
* [ ] Get master to the appropriate code release state. [Travis CI](https://travis-ci.org/pylast/pylast) should be running cleanly for all merges to master. * [ ] Get master to the appropriate code release state.
* [ ] Remove `.dev0` suffix from the version and update version and date in the changelog: [Travis CI](https://travis-ci.org/pylast/pylast) should be running cleanly for
all merges to master.
* [ ] Tag with the version number:
```bash ```bash
git checkout master git tag -a 3.2.0 -m "Release 3.2.0"
edit CHANGELOG.md src/pylast/version.py
```
* [ ] Commit and tag with the version number:
```bash
git add CHANGELOG.md src/pylast/version.py
git commit -m "Release 3.0.0"
git tag -a 3.0.0 -m "Release 3.0.0"
``` ```
* [ ] Push commits and tags: * [ ] Push tag:
```bash
git push ```bash
git push --tags git push --tags
``` ```
* [ ] Create new GitHub release: https://github.com/pylast/pylast/releases/new * [ ] Create new GitHub release: https://github.com/pylast/pylast/releases/new
* Tag: Pick existing tag "3.0.0"
* Title: "Release 3.0.0"
* [ ] Check the tagged [Travis CI build](https://travis-ci.org/pylast/pylast) has deployed to [PyPI](https://pypi.org/project/pylast/#history) * Tag: Pick existing tag "3.2.0"
* [ ] Check installation: `pip3 uninstall -y pylast && pip3 install -U pylast` * [ ] Check the tagged [Travis CI build](https://travis-ci.org/pylast/pylast) has
deployed to [PyPI](https://pypi.org/project/pylast/#history)
* [ ] Check installation:
* [ ] Increment version and append `.dev0`, and add Unreleased to the changelog:
```bash ```bash
git checkout master pip3 uninstall -y pylast && pip3 install -U pylast
edit CHANGELOG.md src/pylast/version.py
```
* [ ] Commit and push:
```bash
git add CHANGELOG.md src/pylast/version.py
git commit -m "Start new release cycle"
git push
``` ```

View file

@ -1,25 +1,29 @@
#!/usr/bin/env python
from setuptools import find_packages, setup from setuptools import find_packages, setup
version_dict = {}
with open("src/pylast/version.py") as f:
exec(f.read(), version_dict)
version = version_dict["__version__"]
with open("README.md") as f: with open("README.md") as f:
long_description = f.read() long_description = f.read()
def local_scheme(version):
"""Skip the local version (eg. +xyz of 0.6.1.dev4+gdf99fe2)
to be able to upload to Test PyPI"""
return ""
setup( setup(
name="pylast", name="pylast",
description="A Python interface to Last.fm and Libre.fm", description="A Python interface to Last.fm and Libre.fm",
long_description=long_description, long_description=long_description,
long_description_content_type="text/markdown", long_description_content_type="text/markdown",
version=version,
author="Amr Hassan <amr.hassan@gmail.com> and Contributors", author="Amr Hassan <amr.hassan@gmail.com> and Contributors",
author_email="amr.hassan@gmail.com", author_email="amr.hassan@gmail.com",
url="https://github.com/pylast/pylast", url="https://github.com/pylast/pylast",
license="Apache2",
keywords=["Last.fm", "music", "scrobble", "scrobbling"],
packages=find_packages(where="src"),
package_dir={"": "src"},
use_scm_version={"local_scheme": local_scheme},
setup_requires=["setuptools_scm"],
extras_require={ extras_require={
"tests": ["flaky", "pytest", "pytest-cov", "pytest-random-order", "pyyaml"] "tests": ["flaky", "pytest", "pytest-cov", "pytest-random-order", "pyyaml"]
}, },
@ -39,10 +43,6 @@ setup(
"Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy", "Programming Language :: Python :: Implementation :: PyPy",
], ],
keywords=["Last.fm", "music", "scrobble", "scrobbling"],
packages=find_packages(where="src"),
package_dir={"": "src"},
license="Apache2",
) )
# End of file # End of file

View file

@ -33,13 +33,13 @@ from http.client import HTTPSConnection
from urllib.parse import quote_plus from urllib.parse import quote_plus
from xml.dom import Node, minidom from xml.dom import Node, minidom
from . import version import pkg_resources
__author__ = "Amr Hassan, hugovk, Mice Pápai" __author__ = "Amr Hassan, hugovk, Mice Pápai"
__copyright__ = "Copyright (C) 2008-2010 Amr Hassan, 2013-2019 hugovk, 2017 Mice Pápai" __copyright__ = "Copyright (C) 2008-2010 Amr Hassan, 2013-2019 hugovk, 2017 Mice Pápai"
__license__ = "apache2" __license__ = "apache2"
__email__ = "amr.hassan@gmail.com" __email__ = "amr.hassan@gmail.com"
__version__ = version.__version__ __version__ = pkg_resources.get_distribution(__name__).version
# 1 : This error does not exist # 1 : This error does not exist

View file

@ -1,2 +0,0 @@
# Master version for pylast
__version__ = "3.2.0.dev0"