Skip to content

Commit

Permalink
Drop Python 3.6 & 3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-c committed Sep 2, 2023
1 parent 139c64b commit c74e030
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 57 deletions.
16 changes: 3 additions & 13 deletions .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,13 @@ jobs:
tox:
name: CI tests via Tox

runs-on: ubuntu-20.04 # 22.04 doesn't support Python 3.6
runs-on: ubuntu-22.04

strategy:
matrix:
py-ver-major: [3]
py-ver-minor: [6, 7, 8, 9, 10, 11, 12]
py-ver-minor: [8, 9, 10, 11, 12]
step: [lint, unit, bandit, mypy]
exclude:
- py-ver-major: 3
py-ver-minor: 6
step: mypy
- py-ver-major: 3
py-ver-minor: 6
step: lint
- py-ver-major: 3
py-ver-minor: 7
step: lint

env:
py-semver: ${{ format('{0}.{1}', matrix.py-ver-major, matrix.py-ver-minor) }}
Expand Down Expand Up @@ -83,7 +73,7 @@ jobs:
tox-style:
name: CI linters via Tox

runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

strategy:
matrix:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tag_to_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
release_to_pypi:
name: cwl-utils release test

runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Style guide:
- PEP-8 / format with ``black`` via ``make format``
- Python 3.6+ compatible code
- Python 3.8+ compatible code
- PEP-484 type hints

It is suggested that you run `git config blame.ignoreRevsFile .git-blame-ignore-revs`
Expand Down
10 changes: 4 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ PYSOURCES=$(filter-out $(MODULE)/parser/cwl_v%,$(shell find $(MODULE) -name "*.p
$(wildcard tests/*.py) create_cwl_from_objects.py load_cwl_by_path.py \
setup.py ${MODULE}/parser/cwl_v1_?_utils.py docs/conf.py
DEVPKGS=diff_cover pylint pep257 pydocstyle flake8 tox tox-pyenv \
isort wheel autoflake pyupgrade bandit -rlint-requirements.txt \
-rtest-requirements.txt -rmypy-requirements.txt
isort wheel autoflake pyupgrade bandit auto-walrus \
-rlint-requirements.txt -rtest-requirements.txt -rmypy-requirements.txt
DEBDEVPKGS=pep8 python-autopep8 pylint python-coverage pydocstyle sloccount \
python-flake8 python-mock shellcheck
VERSION=v$(shell echo $$(tail -n 1 cwl_utils/__meta__.py | awk '{print $$3}'))
Expand Down Expand Up @@ -173,14 +173,12 @@ mypy3: mypy
mypy: $(filter-out setup.py,${PYSOURCES})
MYPYPATH=$$MYPYPATH:mypy-stubs mypy $^

mypy_3.6: $(filter-out setup.py,${PYSOURCES})
MYPYPATH=$$MYPYPATH:mypy-stubs mypy --python-version 3.6 $^

shellcheck: FORCE
shellcheck release-test.sh

pyupgrade: $(PYSOURCES)
pyupgrade --exit-zero-even-if-changed --py36-plus $^
pyupgrade --exit-zero-even-if-changed --py38-plus $^
auto-walrus $^

release-test: FORCE
git diff-index --quiet HEAD -- || ( echo You have uncommitted changes, please commit them and try again; false )
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ and `CWL
v1.2 <https://github.com/common-workflow-language/cwl-utils/blob/main/cwl_utils/parser/v1_2.py>`__
documents.

Requires Python 3.6+
Requires Python 3.8+

Installation
------------
Expand Down
3 changes: 1 addition & 2 deletions cwl_utils/expression.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,9 @@ def evaluator(
**kwargs: Any,
) -> Optional[CWLOutputType]:
js_engine = js_engine or get_js_engine()
match = param_re.match(ex)
expression_parse_exception = None

if match is not None:
if (match := param_re.match(ex)) is not None:
first_symbol = match.group(1)
first_symbol_end = match.end(1)

Expand Down
3 changes: 1 addition & 2 deletions cwl_utils/parser/cwl_v1_2_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ def _compare_type(type1: Any, type2: Any) -> bool:
def _is_conditional_step(
param_to_step: Dict[str, cwl.WorkflowStep], parm_id: str
) -> bool:
source_step = param_to_step.get(parm_id)
if source_step is not None:
if (source_step := param_to_step.get(parm_id)) is not None:
if source_step.when is not None:
return True
return False
Expand Down
10 changes: 5 additions & 5 deletions cwl_utils/sandboxjs.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def check_js_threshold_version(self, working_alias: str) -> bool:
"""
# parse nodejs version into int Tuple: 'v4.2.6\n' -> [4, 2, 6]
current_version_str = subprocess.check_output( # nosec
[working_alias, "-v"], universal_newlines=True
[working_alias, "-v"], text=True
)
current_version = [
int(v) for v in current_version_str.strip().strip("v").split(".")
Expand Down Expand Up @@ -294,7 +294,7 @@ def new_js_proc(
if (
subprocess.check_output( # nosec
[n, "--eval", "process.stdout.write('t')"],
universal_newlines=True,
text=True,
)
!= "t"
):
Expand Down Expand Up @@ -326,7 +326,7 @@ def new_js_proc(
if container_engine in ("docker", "podman"):
dockerimgs = subprocess.check_output( # nosec
[container_engine, "images", "-q", nodeimg],
universal_newlines=True,
text=True,
)
elif container_engine == "singularity":
singularity_cache = os.environ.get("CWL_SINGULARITY_CACHE")
Expand All @@ -345,7 +345,7 @@ def new_js_proc(
re.escape(nodeimg),
subprocess.check_output( # nosec
[container_engine, "images"],
universal_newlines=True,
text=True,
),
)
if matches:
Expand All @@ -369,7 +369,7 @@ def new_js_proc(
nodejs_pull_commands.append(nodeimg)
cwd = singularity_cache if singularity_cache else os.getcwd()
nodejsimg = subprocess.check_output( # nosec
nodejs_pull_commands, universal_newlines=True, cwd=cwd
nodejs_pull_commands, text=True, cwd=cwd
)
_logger.debug(
"Pulled Docker image %s %s using %s",
Expand Down
2 changes: 1 addition & 1 deletion cwl_utils/singularity.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def get_version() -> Tuple[List[int], str]:
global _SINGULARITY_FLAVOR # pylint: disable=global-statement
if _SINGULARITY_VERSION is None:
version_output = check_output( # nosec
["singularity", "--version"], universal_newlines=True
["singularity", "--version"], text=True
).strip()

version_match = re.match(r"(.+) version ([0-9\.]+)", version_output)
Expand Down
4 changes: 1 addition & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
author_email="common-workflow-language@googlegroups.com",
url="https://github.com/common-workflow-language/cwl-utils",
license="Apache 2.0",
python_requires=">=3.6",
python_requires=">=3.8",
setup_requires=pytest_runner,
packages=["cwl_utils", "cwl_utils.parser", "cwl_utils.tests", "cwl_utils.testdata"],
package_dir={
Expand Down Expand Up @@ -55,8 +55,6 @@
"License :: OSI Approved :: Apache Software License",
"Operating System :: POSIX",
"Operating System :: MacOS :: MacOS X",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand Down
40 changes: 18 additions & 22 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[tox]
envlist =
py3{8,9,10,11,12}-lint,
py3{6,7,8,9,10,11,12}-unit,
py3{6,7,8,9,10,11,12}-bandit,
py3{7,8,9,10,11,12}-mypy,
py3{8,9,10,11,12}-unit,
py3{8,9,10,11,12}-bandit,
py3{8,9,10,11,12}-mypy,
py311-lint-readme,
py311-pydocstyle

Expand All @@ -14,8 +14,6 @@ addopts=-n auto

[gh-actions]
python =
3.6: py36
3.7: py37
3.8: py38
3.9: py39
3.10: py310
Expand All @@ -24,47 +22,45 @@ python =

[testenv]
description =
py3{6,7,8,9,10,11,12}-unit: Run the unit tests
py3{8,9,10,11,12}-unit: Run the unit tests
py3{8,9,10,11,12}-lint: Lint the Python code
py3{6,7,8,9,10,11,12}-bandit: Search for common security issues
py3{7,8,9,10,11,12}-mypy: Check for type safety
py3{8,9,10,11,12}-bandit: Search for common security issues
py3{8,9,10,11,12}-mypy: Check for type safety
py311-pydocstyle: docstring style checker
py311-lint-readme: Lint the README.rst->.md conversion

passenv =
CI
GITHUB_*
deps =
py3{6,7,8,9,10,11,12}-{unit,mypy}: -rrequirements.txt
py3{6,7,8,9,10,11,12}-{unit,mypy}: -rtest-requirements.txt
py3{8,9,10,11,12}-{unit,mypy}: -rrequirements.txt
py3{8,9,10,11,12}-{unit,mypy}: -rtest-requirements.txt
py3{8,9,10,11,12}-lint: -rlint-requirements.txt
py3{6,7,8,9,10,11,12}-bandit: bandit
py3{6,7}-bandit: importlib-metadata<5 # work around https://github.com/PyCQA/bandit/issues/956
py3{7,8,9,10,11,12}-mypy: -rmypy-requirements.txt
py3{8,9,10,11,12}-bandit: bandit
py3{8,9,10,11,12}-mypy: -rmypy-requirements.txt

setenv =
py3{6,7,8,9,10,11,12}-unit: LC_ALL = C.UTF-8
py3{8,9,10,11,12}-unit: LC_ALL = C.UTF-8

commands =
py3{6,7,8,9,10,11,12}-unit: python -m pip install -U pip setuptools wheel
py3{6,7,8,9,10,11,12}-unit: make coverage-report coverage.xml PYTEST_EXTRA={posargs}
py3{6,7,8,9,10,11,12}-bandit: bandit --recursive cwl_utils
py3{8,9,10,11,12}-unit: python -m pip install -U pip setuptools wheel
py3{8,9,10,11,12}-unit: make coverage-report coverage.xml PYTEST_EXTRA={posargs}
py3{8,9,10,11,12}-bandit: bandit --recursive cwl_utils
py3{8,9,10,11,12}-lint: make flake8
py3{8,9,10,11,12}-lint: make format-check
py3{7,8,9,10,11,12}-mypy: make mypy
py37-mypy: make mypy_3.6
py3{8,9,10,11,12}-mypy: make mypy

allowlist_externals =
py3{8,9,10,11,12}-lint: flake8
py3{8,9,10,11,12}-lint: black
py3{6,7,8,9,10,11,12}-{mypy,shellcheck,lint,unit}: make
py3{8,9,10,11,12}-{mypy,shellcheck,lint,unit}: make

skip_install =
py{8,9,10,11,12}-lint: true
py{6,7,8,9,10,11,12}-bandit: true
py{8,9,10,11,12}-bandit: true

extras =
py3{6,7,8,9,10,11,12}-unit: pretty
py3{8,9,10,11,12}-unit: pretty

[testenv:py311-pydocstyle]
allowlist_externals = make
Expand Down

0 comments on commit c74e030

Please sign in to comment.