From 38fafff8ea1387fcac1b2a4d1a0f5900225736c7 Mon Sep 17 00:00:00 2001 From: Avi Kelman Date: Wed, 10 Jun 2020 11:10:01 -0600 Subject: [PATCH] :pencil: Add setuptools version section to readme --- README.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/README.md b/README.md index 0d63af0..e23c53f 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,35 @@ new release version and generates your assets and then creates `.github/release_assets.txt` containing a list of the files you want to upload, one per line, in the order that you want them to appear. +## Part 3 for Python setuptools packages: Get package version from repository metadata + +If your repository is a Python setuptools package, you'll want to tie the +package version to the repository release version. The easiest way to do that +is with the `setuptools_scm` package. + +If your project uses a `setup.py` file, do this instead of explicitly stating a +version: + +```Python +from setuptools import setup + +setup( + use_scm_version={ + "local_scheme": "dirty-tag", + "version_scheme": "post-release", + }, + setup_requires=["setuptools_scm"], + ... +) +``` + +See for +an example. + +If you use one of the other setuptools configuration methods (e.g. +`pyproject.toml`), read for the +equivalent of the above. + ## What the parts do ### What the CLI does @@ -63,3 +92,9 @@ When a special release branch is merged into master: 2. If a `.github/prepare_assets.sh` script exists, it is run. 3. If a `.github/release_assets.txt` file exists, any files listed in it are then uploaded to the GitHub release. + +### What the setuptools modification does + +It uses the repository's semantic version release tags as the Python package +version instead of needing to separately store the version somewhere in the +repository files.