Skip to content

Commit 31ded51

Browse files
committed
switch to setuptools_scm
1 parent 14e1dd9 commit 31ded51

15 files changed

+47
-80
lines changed

.github/workflows/ci-tests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,8 @@ jobs:
249249
runs-on: ubuntu-latest
250250
steps:
251251
- uses: actions/checkout@v4
252+
- name: record cwltool version
253+
run: pip install -U setuptools wheel && pip install setuptools_scm[toml] && python setup.py --version
252254
- name: build & test cwltool_module container
253255
run: ./build-cwltool-docker.sh
254256

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ value
5353

5454
.python-version
5555

56+
cwltool/_version.py
57+
5658
# Folder created when using make
5759
cwltool_deps
5860
docs/_build/

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ include README.rst CODE_OF_CONDUCT.md CONTRIBUTING.md
22
include MANIFEST.in
33
include LICENSE.txt
44
include *requirements.txt mypy.ini tox.ini
5-
include gittaggers.py Makefile cwltool.py
5+
include Makefile cwltool.py
66
recursive-include mypy-stubs *.pyi *.py
77
include tests/*
88
include tests/cwl-conformance/cwltool-conftest.py

Makefile

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ check-python3:
7777
python --version 2>&1 | grep "Python 3"
7878

7979
dist/${MODULE}-$(VERSION).tar.gz: check-python3 $(SOURCES)
80-
python setup.py sdist bdist_wheel
80+
python -m build
8181

8282
## docs : make the docs
8383
docs: FORCE
@@ -122,10 +122,10 @@ codespell-fix:
122122

123123
## format : check/fix all code indentation and formatting (runs black)
124124
format:
125-
black --exclude cwltool/schemas setup.py cwltool.py cwltool tests mypy-stubs
125+
black --exclude cwltool/schemas --exclude cwltool/_version.py setup.py cwltool.py cwltool tests mypy-stubs
126126

127127
format-check:
128-
black --diff --check --exclude cwltool/schemas setup.py cwltool.py cwltool tests mypy-stubs
128+
black --diff --check --exclude cwltool/schemas setup.py --exclude cwltool/_version.py cwltool.py cwltool tests mypy-stubs
129129

130130
## pylint : run static code analysis on Python code
131131
pylint: $(PYSOURCES)
@@ -202,11 +202,13 @@ release-test: check-python3 FORCE
202202
./release-test.sh
203203

204204
release: release-test
205+
git tag ${VERSION}
205206
. testenv2/bin/activate && \
206-
python testenv2/src/${MODULE}/setup.py sdist bdist_wheel && \
207+
pip install build && \
208+
python -m build testenv2/src/${PACKAGE} && \
207209
pip install twine && \
208-
twine upload testenv2/src/${MODULE}/dist/* && \
209-
git tag ${VERSION} && git push --tags
210+
twine upload testenv2/src/${PACKAGE}/dist/* && \
211+
git push --tags
210212

211213
flake8: $(PYSOURCES)
212214
flake8 $^

build-cwltool-docker.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
#!/bin/bash
22
set -ex
3-
docker build --file=cwltool.Dockerfile --tag=quay.io/commonwl/cwltool_module --target module .
4-
docker build --file=cwltool.Dockerfile --tag=quay.io/commonwl/cwltool .
3+
engine=${ENGINE:-docker} # example: `ENGINE=podman ./build-cwltool-docker.sh`
4+
${engine} build --file=cwltool.Dockerfile --tag=quay.io/commonwl/cwltool_module --target module .
5+
${engine} build --file=cwltool.Dockerfile --tag=quay.io/commonwl/cwltool .
56

6-
docker run -t -v /var/run/docker.sock:/var/run/docker.sock \
7+
${engine} run -t -v /var/run/docker.sock:/var/run/docker.sock \
78
-v /tmp:/tmp \
89
-v "$PWD":/tmp/cwltool \
910
quay.io/commonwl/cwltool_module /bin/sh -c \

cwltool.Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ RUN apk add --no-cache git gcc python3-dev libxml2-dev libxslt-dev libc-dev linu
44

55
WORKDIR /cwltool
66
COPY . .
7-
RUN CWLTOOL_USE_MYPYC=1 MYPYPATH=mypy-stubs pip wheel --no-binary schema-salad \
7+
RUN export SETUPTOOLS_SCM_PRETEND_VERSION_FOR_CWLTOOL=$(grep __version__ cwltool/_version.py | awk -F\' '{ print $2 }') ; \
8+
CWLTOOL_USE_MYPYC=1 MYPYPATH=mypy-stubs pip wheel --no-binary schema-salad \
89
--wheel-dir=/wheels .[deps] # --verbose
910
RUN rm /wheels/schema_salad*
1011
RUN pip install "black~=22.0"

gittaggers.py

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

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[build-system]
22
requires = [
33
"setuptools>=45",
4+
"setuptools_scm[toml]>=8.0.4,<9",
45
"mypy==1.6.0", # also update mypy-requirements.txt
56
"types-requests",
67
"types-psutil",
@@ -14,6 +15,9 @@ requires = [
1415
]
1516
build-backend = "setuptools.build_meta"
1617

18+
[tool.setuptools_scm]
19+
write_to = "cwltool/_version.py"
20+
1721
[tool.black]
1822
line-length = 100
1923
target-version = [ "py38" ]

release-test.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ then
4242
rm -f testenv1/lib/python-wheels/setuptools* \
4343
&& pip install --force-reinstall -U pip==${pipver} \
4444
&& pip install setuptools==${setuptoolsver} wheel
45-
pip install --no-build-isolation -rtest-requirements.txt ".${extras}"
45+
pip install -rtest-requirements.txt ".${extras}"
4646
#make test
4747
pip uninstall -y ${package} || true; pip uninstall -y ${package} || true; make install
4848
# mkdir testenv1/not-${module}
@@ -68,7 +68,7 @@ rm -f lib/python-wheels/setuptools* \
6868
# The following can fail if you haven't pushed your commits to ${repo}
6969
pip install -e "git+${repo}@${HEAD}#egg=${package}${extras}"
7070
pushd src/${package}
71-
pip install -rtest-requirements.txt
71+
pip install -rtest-requirements.txt build
7272
make dist
7373
#make test
7474
cp dist/${package}*tar.gz ../../../testenv3/
@@ -88,7 +88,7 @@ rm -f lib/python-wheels/setuptools* \
8888
&& pip install --force-reinstall -U pip==${pipver} \
8989
&& pip install setuptools==${setuptoolsver} wheel
9090
package_tar=$(find . -name "${package}*tar.gz")
91-
pip install "-r${DIR}/test-requirements.txt" udocker
91+
pip install "-r${DIR}/test-requirements.txt" udocker build
9292
pip install "${package_tar}${extras}"
9393
udocker install
9494
mkdir out
@@ -97,7 +97,7 @@ pushd out/${package}*
9797
make dist
9898
make test
9999
pip install "-r${DIR}/mypy-requirements.txt"
100-
make mypy
100+
make mypyc
101101
pip uninstall -y ${package} || true; pip uninstall -y ${package} || true; make install
102102
mkdir ../not-${module}
103103
pushd ../not-${module}

setup.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
import os
44
import sys
55
import warnings
6-
from typing import Type
76

8-
import setuptools.command.egg_info as egg_info_cmd
97
from setuptools import setup
108

119
if os.name == "nt":
@@ -25,13 +23,6 @@
2523
SETUP_DIR = os.path.dirname(__file__)
2624
README = os.path.join(SETUP_DIR, "README.rst")
2725

28-
try:
29-
import gittaggers
30-
31-
Tagger: Type[egg_info_cmd.egg_info] = gittaggers.EggInfoFromGit
32-
except ImportError:
33-
Tagger = egg_info_cmd.egg_info
34-
3526
NEEDS_PYTEST = {"pytest", "test", "ptr"}.intersection(sys.argv)
3627
PYTEST_RUNNER = ["pytest-runner", "pytest-cov"] if NEEDS_PYTEST else []
3728
USE_MYPYC = False
@@ -94,7 +85,6 @@
9485

9586
setup(
9687
name="cwltool",
97-
version="3.1",
9888
description="Common workflow language reference implementation",
9989
long_description=open(README).read(),
10090
long_description_content_type="text/x-rst",
@@ -130,7 +120,8 @@
130120
"deps": ["galaxy-tool-util >= 22.1.2, <24", "galaxy-util <24"],
131121
},
132122
python_requires=">=3.8, <4",
133-
setup_requires=PYTEST_RUNNER,
123+
use_scm_version=True,
124+
setup_requires=PYTEST_RUNNER + ["setuptools_scm>=8.0.4,<9"],
134125
test_suite="tests",
135126
tests_require=[
136127
"bagit >= 1.6.4, < 1.9",
@@ -142,7 +133,6 @@
142133
],
143134
entry_points={"console_scripts": ["cwltool=cwltool.main:run"]},
144135
zip_safe=True,
145-
cmdclass={"egg_info": Tagger},
146136
classifiers=[
147137
"Development Status :: 5 - Production/Stable",
148138
"Environment :: Console",

0 commit comments

Comments
 (0)