Skip to content

Commit

Permalink
Switch to setuptools_scm
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-c committed Oct 31, 2023
1 parent cc5ef54 commit 6dd1714
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 59 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
*.egg-info
build
dist

cwltest/_version.py
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -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
Expand Down
18 changes: 10 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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 $^ > $@
Expand All @@ -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))
Expand All @@ -176,16 +176,18 @@ 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} && \
pip install twine && \
twine upload testenv2/src/${PACKAGE}/dist/* && \
git tag ${VERSION} && git push --tags

flake8: $(PYSOURCES)
flake8 $^
flake8: FORCE
flake8 $(PYSOURCES)

FORCE:

Expand Down
37 changes: 0 additions & 37 deletions gittaggers.py

This file was deleted.

18 changes: 5 additions & 13 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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/*"]},
Expand All @@ -57,7 +50,6 @@
],
},
zip_safe=True,
cmdclass={"egg_info": tagger},
classifiers=[
"Environment :: Console",
"License :: OSI Approved :: Apache Software License",
Expand Down

0 comments on commit 6dd1714

Please sign in to comment.