Skip to content

Commit 6c32ae5

Browse files
committed
add back in Python 3.7 for one last release
1 parent f1e0580 commit 6c32ae5

12 files changed

+57
-27
lines changed

.github/workflows/ci-tests.yml

+11-1
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,18 @@ jobs:
3232
strategy:
3333
matrix:
3434
py-ver-major: [3]
35-
py-ver-minor: [8, 9, 10, 11, 12]
35+
py-ver-minor: [7, 8, 9, 10, 11, 12]
3636
step: [lint, unit, bandit, mypy]
37+
exclude:
38+
- py-ver-major: 3
39+
py-ver-minor: 7
40+
step: mypy
41+
- py-ver-major: 3
42+
py-ver-minor: 7
43+
step: lint
44+
- py-ver-major: 3
45+
py-ver-minor: 7
46+
step: bandit
3747

3848
env:
3949
py-semver: ${{ format('{0}.{1}', matrix.py-ver-major, matrix.py-ver-minor) }}

cwltool/checker.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
Dict,
66
Iterator,
77
List,
8-
Literal,
98
MutableMapping,
109
MutableSequence,
1110
Optional,
1211
Sized,
1312
Union,
1413
cast,
1514
)
15+
from typing_extensions import Literal
1616

1717
from schema_salad.exceptions import ValidationException
1818
from schema_salad.sourceline import SourceLine, bullets, strip_dup_lineno
@@ -509,7 +509,8 @@ def get_step_id(field_id: str) -> str:
509509

510510

511511
def is_conditional_step(param_to_step: Dict[str, CWLObjectType], parm_id: str) -> bool:
512-
if (source_step := param_to_step.get(parm_id)) is not None:
512+
source_step = param_to_step.get(parm_id)
513+
if source_step is not None:
513514
if source_step.get("when") is not None:
514515
return True
515516
return False

cwltool/context.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
Dict,
1313
Iterable,
1414
List,
15-
Literal,
1615
Optional,
1716
TextIO,
1817
Tuple,
1918
Union,
2019
)
20+
from typing_extensions import Literal
2121

2222
from ruamel.yaml.comments import CommentedMap
2323
from schema_salad.avro.schema import Names

cwltool/cwlprov/__init__.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
import re
77
import uuid
88
from getpass import getuser
9-
from typing import IO, Any, Callable, Dict, List, Optional, Tuple, TypedDict, Union
9+
from typing import IO, Any, Callable, Dict, List, Optional, Tuple, Union
10+
from typing_extensions import TypedDict
1011

1112

1213
def _whoami() -> Tuple[str, str]:

cwltool/software_requirements.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,9 @@ def build_job_script(self, builder: "Builder", command: List[str]) -> str:
9191
resolution_config_dict=resolution_config_dict,
9292
conf_file=self.dependency_resolvers_config_file,
9393
)
94-
handle_dependencies: str = ""
95-
if dependencies := get_dependencies(builder):
94+
dependencies = get_dependencies(builder)
95+
handle_dependencies = "" # str
96+
if dependencies:
9697
handle_dependencies = "\n".join(
9798
tool_dependency_manager.dependency_shell_commands(
9899
dependencies, job_directory=builder.tmpdir

cwltool/utils.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"""Shared functions and other definitions."""
22
import collections
33
import fcntl
4-
import importlib.metadata
54
import os
65
import random
76
import shutil
@@ -28,17 +27,16 @@
2827
Generator,
2928
Iterable,
3029
List,
31-
Literal,
3230
MutableMapping,
3331
MutableSequence,
3432
NamedTuple,
3533
Optional,
3634
Set,
3735
Tuple,
38-
TypedDict,
3936
Union,
4037
cast,
4138
)
39+
from typing_extensions import Literal, TypedDict
4240

4341
import requests
4442
from cachecontrol import CacheControl
@@ -47,6 +45,11 @@
4745
from schema_salad.exceptions import ValidationException
4846
from schema_salad.ref_resolver import Loader
4947

48+
if sys.version_info >= (3, 8):
49+
import importlib.metadata as importlib_metadata
50+
else:
51+
import importlib_metadata
52+
5053
if TYPE_CHECKING:
5154
from .command_line_tool import CallbackJob, ExpressionJob
5255
from .job import CommandLineJob, JobBase
@@ -117,7 +120,8 @@ class WorkflowStateItem(NamedTuple):
117120

118121
def versionstring() -> str:
119122
"""Version of CWLtool used to execute the workflow."""
120-
if pkg := importlib.metadata.version("cwltool"):
123+
pkg = importlib_metadata.version("cwltool")
124+
if pkg:
121125
return f"{sys.argv[0]} {pkg}"
122126
return "{} {}".format(sys.argv[0], "unknown version")
123127

docs/conf.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import sys
1515
from datetime import datetime
1616
import time
17-
import importlib.metadata
1817

1918
sys.path.insert(0, os.path.abspath(".."))
2019

@@ -82,7 +81,12 @@
8281
# so a file named "default.css" will overwrite the builtin "default.css".
8382
html_static_path = ["_static"]
8483

85-
release = importlib.metadata.version("cwltool")
84+
85+
if sys.version_info >= (3, 8):
86+
import importlib.metadata as importlib_metadata
87+
else:
88+
import importlib_metadata
89+
release = importlib_metadata.version("cwltool")
8690
version = ".".join(release.split(".")[:2])
8791

8892
autoapi_dirs = ["../cwltool"]

gittaggers.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@
22
import sys
33
import time
44

5-
import importlib.metadata
5+
if sys.version_info >= (3, 8):
6+
import importlib.metadata as importlib_metadata
7+
else:
8+
import importlib_metadata
69

710
from typing import Any
811

912
from setuptools.command.egg_info import egg_info
1013

11-
SETUPTOOLS_VER = importlib.metadata.version("setuptools").split(".")
14+
SETUPTOOLS_VER = importlib_metadata.version("setuptools").split(".")
1215

1316
RECENT_SETUPTOOLS = (
1417
int(SETUPTOOLS_VER[0]) > 40

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ build-backend = "setuptools.build_meta"
1515

1616
[tool.black]
1717
line-length = 100
18-
target-version = [ "py38" ]
18+
target-version = [ "py37" ]

requirements.txt

+2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ schema-salad>=8.4.20230426093816,<9
77
prov==1.5.1
88
mypy-extensions
99
psutil>=5.6.6
10+
typing-extensions
1011
importlib_resources>=1.4 # equivalent to Python 3.9
12+
importlib_metadata;python_version<'3.8' # equivalent to Python 3.9
1113
coloredlogs
1214
pydot>=1.4.1
1315
argcomplete>=1.12.0

setup.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@
120120
"prov == 1.5.1",
121121
"mypy-extensions",
122122
"psutil >= 5.6.6",
123+
"typing-extensions",
123124
"importlib_resources>=1.4",
125+
"importlib_metadata;python_version<'3.8'",
124126
"coloredlogs",
125127
"pydot >= 1.4.1",
126128
"argcomplete",
@@ -130,7 +132,7 @@
130132
extras_require={
131133
"deps": ["galaxy-tool-util >= 22.1.2, <23", "galaxy-util <23"],
132134
},
133-
python_requires=">=3.8, <4",
135+
python_requires=">=3.7, <4",
134136
setup_requires=PYTEST_RUNNER,
135137
test_suite="tests",
136138
tests_require=[
@@ -156,6 +158,7 @@
156158
"Operating System :: POSIX",
157159
"Operating System :: POSIX :: Linux",
158160
"Programming Language :: Python :: 3",
161+
"Programming Language :: Python :: 3.7",
159162
"Programming Language :: Python :: 3.8",
160163
"Programming Language :: Python :: 3.9",
161164
"Programming Language :: Python :: 3.10",

tox.ini

+11-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[tox]
22
envlist =
33
py3{8,9,10,11,12}-lint
4-
py3{8,9,10,11,12}-unit
4+
py3{7,8,9,10,11,12}-unit
55
py3{8,9,10,11,12}-bandit
66
py3{8,9,10,11,12}-mypy
77
py311-lintreadme
@@ -16,6 +16,7 @@ testpaths = tests
1616

1717
[gh-actions]
1818
python =
19+
3.7: py37
1920
3.8: py38
2021
3.9: py39
2122
3.10: py310
@@ -24,10 +25,10 @@ python =
2425

2526
[testenv]
2627
skipsdist =
27-
py3{8,9,10,11,12}-!{unit,mypy,lintreadme} = True
28+
py3{7,8,9,10,11,12}-!{unit,mypy,lintreadme} = True
2829

2930
description =
30-
py3{8,9,10,11,12}-unit: Run the unit tests
31+
py3{7,8,9,10,11,12}-unit: Run the unit tests
3132
py3{8,9,10,11,12}-lint: Lint the Python code
3233
py3{8,9,10,11,12}-bandit: Search for common security issues
3334
py3{8,9,10,11,12}-mypy: Check for type safety
@@ -41,11 +42,11 @@ passenv =
4142
PROOT_NO_SECCOMP
4243

4344
extras =
44-
py3{8,9,10,11,12}-unit: deps
45+
py3{7,8,9,10,11,12}-unit: deps
4546

4647
deps =
47-
py3{8,9,10,11,12}-{unit,lint,bandit,mypy}: -rrequirements.txt
48-
py3{8,9,10,11,12}-{unit,mypy}: -rtest-requirements.txt
48+
py3{7,8,9,10,11,12}-{unit,lint,bandit,mypy}: -rrequirements.txt
49+
py3{7,8,9,10,11,12}-{unit,mypy}: -rtest-requirements.txt
4950
py3{8,9,10,11,12}-lint: -rlint-requirements.txt
5051
py3{8,9,10,11,12}-bandit: bandit
5152
py3{8,9,10,11,12}-bandit: importlib_metadata != 4.8.0
@@ -57,14 +58,14 @@ deps =
5758
py311-lintreadme: readme_renderer[rst]
5859

5960
setenv =
60-
py3{8,9,10,11,12}-unit: LC_ALL = C.UTF-8
61+
py3{7,8,9,10,11,12}-unit: LC_ALL = C.UTF-8
6162

6263
commands_pre =
63-
py3{8,9,10,11,12}-unit: python -m pip install -U pip setuptools wheel
64+
py3{7,8,9,10,11,12}-unit: python -m pip install -U pip setuptools wheel
6465
py311-lintreadme: python -m build --outdir {distdir}
6566

6667
commands =
67-
py3{8,9,10,11,12}-unit: make coverage-report coverage.xml PYTEST_EXTRA={posargs}
68+
py3{7,8,9,10,11,12}-unit: make coverage-report coverage.xml PYTEST_EXTRA={posargs}
6869
py3{8,9,10,11,12}-bandit: bandit -r cwltool
6970
py3{8,9,10,11,12}-lint: make flake8 format-check codespell-check
7071
py3{8,9,10,11,12}-mypy: make mypy PYTEST_EXTRA={posargs}
@@ -74,6 +75,6 @@ commands =
7475
py311-lintreadme: twine check {distdir}/*
7576

7677
skip_install =
77-
py3{8,9,10,11,12}-{bandit,lint,mypy,shellcheck,pydocstyle,lintreadme}: true
78+
py3{7,8,9,10,11,12}-{bandit,lint,mypy,shellcheck,pydocstyle,lintreadme}: true
7879

7980
allowlist_externals = make

0 commit comments

Comments
 (0)