Skip to content

Commit 6dd1714

Browse files
committed
Switch to setuptools_scm
1 parent cc5ef54 commit 6dd1714

File tree

5 files changed

+18
-59
lines changed

5 files changed

+18
-59
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@
55
*.egg-info
66
build
77
dist
8+
9+
cwltest/_version.py

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include Makefile gittaggers.py test-requirements.txt mypy-requirements.txt requirements.txt tox.ini mypy.ini
1+
include Makefile test-requirements.txt mypy-requirements.txt requirements.txt tox.ini mypy.ini
22
include dev-requirements.txt .flake8 .coveragerc release-test.sh
33
include docs/Makefile docs/conf.py docs/requirements.txt docs/_static/favicon.ico docs/*.rst
44
include cwltest/*.yml

Makefile

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ PYSOURCES=$(wildcard ${MODULE}/**.py tests/*.py) setup.py
2929
DEVPKGS=-rdev-requirements.txt -rtest-requirements.txt -rmypy-requirements.txt
3030
DEBDEVPKGS=pep8 python-autopep8 pylint python-coverage pydocstyle sloccount \
3131
python-flake8 python-mock shellcheck
32-
VERSION=2.3.$(shell TZ=UTC git log --first-parent --max-count=1 \
32+
VERSION=2.4.$(shell TZ=UTC git log --first-parent --max-count=1 \
3333
--format=format:%cd --date=format-local:%Y%m%d%H%M%S)
3434

3535
## all : default task (install in dev mode)
@@ -105,10 +105,10 @@ codespell:
105105

106106
## format : check/fix all code indentation and formatting (runs black)
107107
format: $(PYSOURCES) mypy-stubs
108-
black $^
108+
black --exclude cwltest/_version.py $^
109109

110110
format-check: $(PYSOURCES) mypy-stubs
111-
black --diff --check $^
111+
black --diff --check --exclude cwltest/_version.py $^
112112

113113
## pylint : run static code analysis on Python code
114114
pylint: $(PYSOURCES)
@@ -151,7 +151,7 @@ test: $(PYSOURCES)
151151

152152
## testcov : run the cwltest test suite and collect coverage
153153
testcov: $(PYSOURCES)
154-
python setup.py test --addopts "--cov" ${PYTEST_EXTRA}
154+
pytest --cov ${PYTEST_EXTRA}
155155

156156
sloccount.sc: $(PYSOURCES) Makefile
157157
sloccount --duplicates --wide --details $^ > $@
@@ -165,7 +165,7 @@ list-author-emails:
165165
@git log --format='%aN,%aE' | sort -u | grep -v 'root'
166166

167167
mypy3: mypy
168-
mypy: $(filter-out setup.py gittagger.py,$(PYSOURCES))
168+
mypy: $(filter-out setup.py,$(PYSOURCES))
169169
MYPYPATH=$$MYPYPATH:mypy-stubs mypy $^
170170

171171
pyupgrade: $(filter-out schema_salad/metaschema.py,$(PYSOURCES))
@@ -176,16 +176,18 @@ release-test: FORCE
176176
git diff-index --quiet HEAD -- || ( echo You have uncommitted changes, please commit them and try again; false )
177177
./release-test.sh
178178

179-
release: release-test
179+
release:
180+
export SETUPTOOLS_SCM_PRETEND_VERSION=${VERSION} && \
181+
./release-test.sh && \
180182
. testenv2/bin/activate && \
181183
pip install build && \
182184
python -m build testenv2/src/${PACKAGE} && \
183185
pip install twine && \
184186
twine upload testenv2/src/${PACKAGE}/dist/* && \
185187
git tag ${VERSION} && git push --tags
186188

187-
flake8: $(PYSOURCES)
188-
flake8 $^
189+
flake8: FORCE
190+
flake8 $(PYSOURCES)
189191

190192
FORCE:
191193

gittaggers.py

Lines changed: 0 additions & 37 deletions
This file was deleted.

setup.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,18 @@
22
import os
33
import pathlib
44
import sys
5+
from typing import List
56

6-
import setuptools.command.egg_info as egg_info_cmd
77
from setuptools import setup
88

99
SETUP_DIR = os.path.dirname(__file__)
1010
README = os.path.join(SETUP_DIR, "README.rst")
1111

12-
try:
13-
import gittaggers
14-
15-
tagger = gittaggers.EggInfoFromGit
16-
except ImportError:
17-
tagger = egg_info_cmd.egg_info
18-
1912
needs_pytest = {"pytest", "test", "ptr"}.intersection(sys.argv)
20-
pytest_runner = ["pytest < 8", "pytest-runner"] if needs_pytest else []
13+
pytest_runner: List[str] = ["pytest < 8", "pytest-runner"] if needs_pytest else []
2114

2215
setup(
2316
name="cwltest",
24-
version="2.3", # update the VERSION prefix in the Makefile as well 🙂
2517
description="Common Workflow Language testing framework",
2618
long_description=open(README).read(),
2719
long_description_content_type="text/x-rst",
@@ -30,8 +22,9 @@
3022
url="https://github.com/common-workflow-language/cwltest",
3123
download_url="https://github.com/common-workflow-language/cwltest",
3224
license="Apache 2.0",
33-
python_requires=">=3.8, <4",
34-
setup_requires=[] + pytest_runner,
25+
python_requires=">=3.8,<3.13",
26+
use_scm_version=True,
27+
setup_requires=pytest_runner + ["setuptools_scm>=8.0.4,<9"],
3528
packages=["cwltest", "cwltest.tests"],
3629
package_dir={"cwltest.tests": "tests"},
3730
package_data={"cwltest": ["py.typed"], "tests": ["test-data/*"]},
@@ -57,7 +50,6 @@
5750
],
5851
},
5952
zip_safe=True,
60-
cmdclass={"egg_info": tagger},
6153
classifiers=[
6254
"Environment :: Console",
6355
"License :: OSI Approved :: Apache Software License",

0 commit comments

Comments
 (0)