diff --git a/.gitignore b/.gitignore index 27e2aac..613149a 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ *.egg-info build dist + +cwltest/_version.py diff --git a/MANIFEST.in b/MANIFEST.in index 3aec21c..40bd4c8 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,4 @@ -include Makefile gittaggers.py test-requirements.txt mypy-requirements.txt requirements.txt tox.ini mypy.ini +include Makefile test-requirements.txt mypy-requirements.txt requirements.txt tox.ini mypy.ini include dev-requirements.txt .flake8 .coveragerc release-test.sh include docs/Makefile docs/conf.py docs/requirements.txt docs/_static/favicon.ico docs/*.rst include cwltest/*.yml diff --git a/Makefile b/Makefile index 0e5889e..16b3c52 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,7 @@ PYSOURCES=$(wildcard ${MODULE}/**.py tests/*.py) setup.py DEVPKGS=-rdev-requirements.txt -rtest-requirements.txt -rmypy-requirements.txt DEBDEVPKGS=pep8 python-autopep8 pylint python-coverage pydocstyle sloccount \ python-flake8 python-mock shellcheck -VERSION=2.3.$(shell TZ=UTC git log --first-parent --max-count=1 \ +VERSION=2.4.$(shell TZ=UTC git log --first-parent --max-count=1 \ --format=format:%cd --date=format-local:%Y%m%d%H%M%S) ## all : default task (install in dev mode) @@ -105,10 +105,10 @@ codespell: ## format : check/fix all code indentation and formatting (runs black) format: $(PYSOURCES) mypy-stubs - black $^ + black --exclude cwltest/_version.py $^ format-check: $(PYSOURCES) mypy-stubs - black --diff --check $^ + black --diff --check --exclude cwltest/_version.py $^ ## pylint : run static code analysis on Python code pylint: $(PYSOURCES) @@ -151,7 +151,7 @@ test: $(PYSOURCES) ## testcov : run the cwltest test suite and collect coverage testcov: $(PYSOURCES) - python setup.py test --addopts "--cov" ${PYTEST_EXTRA} + pytest --cov ${PYTEST_EXTRA} sloccount.sc: $(PYSOURCES) Makefile sloccount --duplicates --wide --details $^ > $@ @@ -165,7 +165,7 @@ list-author-emails: @git log --format='%aN,%aE' | sort -u | grep -v 'root' mypy3: mypy -mypy: $(filter-out setup.py gittagger.py,$(PYSOURCES)) +mypy: $(filter-out setup.py,$(PYSOURCES)) MYPYPATH=$$MYPYPATH:mypy-stubs mypy $^ pyupgrade: $(filter-out schema_salad/metaschema.py,$(PYSOURCES)) @@ -176,7 +176,9 @@ release-test: FORCE git diff-index --quiet HEAD -- || ( echo You have uncommitted changes, please commit them and try again; false ) ./release-test.sh -release: release-test +release: + export SETUPTOOLS_SCM_PRETEND_VERSION=${VERSION} && \ + ./release-test.sh && \ . testenv2/bin/activate && \ pip install build && \ python -m build testenv2/src/${PACKAGE} && \ @@ -184,8 +186,8 @@ release: release-test twine upload testenv2/src/${PACKAGE}/dist/* && \ git tag ${VERSION} && git push --tags -flake8: $(PYSOURCES) - flake8 $^ +flake8: FORCE + flake8 $(PYSOURCES) FORCE: diff --git a/gittaggers.py b/gittaggers.py deleted file mode 100644 index 39e79f7..0000000 --- a/gittaggers.py +++ /dev/null @@ -1,37 +0,0 @@ -import subprocess -import time - -import pkg_resources -from setuptools.command.egg_info import egg_info - -SETUPTOOLS_VER = pkg_resources.get_distribution( - "setuptools").version.split('.') - -RECENT_SETUPTOOLS = int(SETUPTOOLS_VER[0]) > 40 or ( - int(SETUPTOOLS_VER[0]) == 40 and int(SETUPTOOLS_VER[1]) > 0) or ( - int(SETUPTOOLS_VER[0]) == 40 and int(SETUPTOOLS_VER[1]) == 0 and - int(SETUPTOOLS_VER[2]) > 0) - -class EggInfoFromGit(egg_info): - """Tag the build with git commit timestamp. - - If a build tag has already been set (e.g., "egg_info -b", building - from source package), leave it alone. - """ - - def git_timestamp_tag(self): - gitinfo = subprocess.check_output( - ['git', 'log', '--first-parent', '--max-count=1', - '--format=format:%ct', '.']).strip() - return time.strftime('.%Y%m%d%H%M%S', time.gmtime(int(gitinfo))) - - def tags(self): - if self.tag_build is None: - try: - self.tag_build = self.git_timestamp_tag() - except subprocess.CalledProcessError: - pass - return egg_info.tags(self) - - if RECENT_SETUPTOOLS: - vtags = property(tags) diff --git a/setup.py b/setup.py index 1e19380..13bd5ec 100644 --- a/setup.py +++ b/setup.py @@ -2,26 +2,18 @@ import os import pathlib import sys +from typing import List -import setuptools.command.egg_info as egg_info_cmd from setuptools import setup SETUP_DIR = os.path.dirname(__file__) README = os.path.join(SETUP_DIR, "README.rst") -try: - import gittaggers - - tagger = gittaggers.EggInfoFromGit -except ImportError: - tagger = egg_info_cmd.egg_info - needs_pytest = {"pytest", "test", "ptr"}.intersection(sys.argv) -pytest_runner = ["pytest < 8", "pytest-runner"] if needs_pytest else [] +pytest_runner: List[str] = ["pytest < 8", "pytest-runner"] if needs_pytest else [] setup( name="cwltest", - version="2.3", # update the VERSION prefix in the Makefile as well 🙂 description="Common Workflow Language testing framework", long_description=open(README).read(), long_description_content_type="text/x-rst", @@ -30,8 +22,9 @@ url="https://github.com/common-workflow-language/cwltest", download_url="https://github.com/common-workflow-language/cwltest", license="Apache 2.0", - python_requires=">=3.8, <4", - setup_requires=[] + pytest_runner, + python_requires=">=3.8,<3.13", + use_scm_version=True, + setup_requires=pytest_runner + ["setuptools_scm>=8.0.4,<9"], packages=["cwltest", "cwltest.tests"], package_dir={"cwltest.tests": "tests"}, package_data={"cwltest": ["py.typed"], "tests": ["test-data/*"]}, @@ -57,7 +50,6 @@ ], }, zip_safe=True, - cmdclass={"egg_info": tagger}, classifiers=[ "Environment :: Console", "License :: OSI Approved :: Apache Software License",