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 11, 2023
1 parent bab56aa commit e768e59
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 59 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: record cwltool version
run: pip install -U setuptools wheel && pip install setuptools_scm[toml] && python setup.py --version
- name: build & test cwltool_module container
run: ./build-cwltool-docker.sh

Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ value

.python-version

cwltool/_version.py

# Folder created when using make
cwltool_deps
docs/_build/
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ include README.rst CODE_OF_CONDUCT.md CONTRIBUTING.md
include MANIFEST.in
include LICENSE.txt
include *requirements.txt mypy.ini tox.ini
include gittaggers.py Makefile cwltool.py
include Makefile cwltool.py
recursive-include mypy-stubs *.pyi *.py
include tests/*
include tests/cwl-conformance/cwltool-conftest.py
Expand Down
7 changes: 4 additions & 3 deletions build-cwltool-docker.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#!/bin/bash
set -ex
docker build --file=cwltool.Dockerfile --tag=quay.io/commonwl/cwltool_module --target module .
docker build --file=cwltool.Dockerfile --tag=quay.io/commonwl/cwltool .
engine=${ENGINE:-docker} # example: `ENGINE=podman ./build-cwltool-docker.sh`
${engine} build --file=cwltool.Dockerfile --tag=quay.io/commonwl/cwltool_module --target module .
${engine} build --file=cwltool.Dockerfile --tag=quay.io/commonwl/cwltool .

docker run -t -v /var/run/docker.sock:/var/run/docker.sock \
${engine} run -t -v /var/run/docker.sock:/var/run/docker.sock \
-v /tmp:/tmp \
-v "$PWD":/tmp/cwltool \
quay.io/commonwl/cwltool_module /bin/sh -c \
Expand Down
3 changes: 2 additions & 1 deletion cwltool.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ RUN apk add --no-cache git gcc python3-dev libxml2-dev libxslt-dev libc-dev linu

WORKDIR /cwltool
COPY . .
RUN CWLTOOL_USE_MYPYC=1 MYPYPATH=mypy-stubs pip wheel --no-binary schema-salad \
RUN export SETUPTOOLS_SCM_PRETEND_VERSION_FOR_CWLTOOL=$(grep __version__ cwltool/_version.py | awk -F\' '{ print $2 }') ; \
CWLTOOL_USE_MYPYC=1 MYPYPATH=mypy-stubs pip wheel --no-binary schema-salad \
--wheel-dir=/wheels .[deps] # --verbose
RUN rm /wheels/schema_salad*
RUN pip install "black~=22.0"
Expand Down
42 changes: 0 additions & 42 deletions gittaggers.py

This file was deleted.

4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[build-system]
requires = [
"setuptools>=45",
"setuptools_scm[toml]>=8.0.4,<9",
"mypy==1.6.0", # also update mypy-requirements.txt
"types-requests",
"types-psutil",
Expand All @@ -14,6 +15,9 @@ requires = [
]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
write_to = "cwltool/_version.py"

[tool.black]
line-length = 100
target-version = [ "py38" ]
14 changes: 2 additions & 12 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
import os
import sys
import warnings
from typing import Type

import setuptools.command.egg_info as egg_info_cmd
from setuptools import setup

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

try:
import gittaggers

Tagger: Type[egg_info_cmd.egg_info] = gittaggers.EggInfoFromGit
except ImportError:
Tagger = egg_info_cmd.egg_info

NEEDS_PYTEST = {"pytest", "test", "ptr"}.intersection(sys.argv)
PYTEST_RUNNER = ["pytest-runner", "pytest-cov"] if NEEDS_PYTEST else []
USE_MYPYC = False
Expand Down Expand Up @@ -94,7 +85,6 @@

setup(
name="cwltool",
version="3.1",
description="Common workflow language reference implementation",
long_description=open(README).read(),
long_description_content_type="text/x-rst",
Expand Down Expand Up @@ -130,7 +120,8 @@
"deps": ["galaxy-tool-util >= 22.1.2, <23", "galaxy-util <23"],
},
python_requires=">=3.8, <4",
setup_requires=PYTEST_RUNNER,
use_scm_version=True,
setup_requires=PYTEST_RUNNER + ["setuptools_scm>=8.0.4,<9"],
test_suite="tests",
tests_require=[
"bagit >= 1.6.4, < 1.9",
Expand All @@ -142,7 +133,6 @@
],
entry_points={"console_scripts": ["cwltool=cwltool.main:run"]},
zip_safe=True,
cmdclass={"egg_info": Tagger},
classifiers=[
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
Expand Down

0 comments on commit e768e59

Please sign in to comment.