Skip to content

Commit 25a35ab

Browse files
authored
rename typeshed; misc cleanups (#142)
1 parent a38de2e commit 25a35ab

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+425
-810
lines changed

.github/workflows/ci-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Continous integration tests
1+
name: Continuous integration tests
22

33
on:
44
push:

MANIFEST.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ include Makefile
33
include MANIFEST.in
44
include LICENSE.txt
55
include *requirements.txt
6+
include create_cwl_from_objects.py
7+
include load_cwl_by_path.py
68
include cwl_utils/cwlNodeEngine.js
79
include cwl_utils/cwlNodeEngineJSConsole.js
810
include cwl_utils/cwlNodeEngineWithContext.js

Makefile

Lines changed: 34 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ EXTRAS=
2626

2727
# `SHELL=bash` doesn't work for some, so don't use BASH-isms like
2828
# `[[` conditional expressions.
29-
PYSOURCES=$(filter-out $(MODULE)/parser/cwl_v%,$(shell find $(MODULE) -name "*.py")) $(wildcard tests/*.py) $(wildcard *.py)
29+
PYSOURCES=$(filter-out $(MODULE)/parser/cwl_v%,$(shell find $(MODULE) -name "*.py")) $(wildcard tests/*.py) create_cwl_from_objects.py load_cwl_by_path.py setup.py
3030
DEVPKGS=diff_cover black pylint pep257 pydocstyle flake8 tox tox-pyenv \
3131
isort wheel autoflake flake8-bugbear pyupgrade bandit \
3232
-rtest-requirements.txt -rmypy-requirements.txt
@@ -36,76 +36,84 @@ VERSION=v$(shell echo $$(tail -n 1 cwl_utils/__meta__.py | awk '{print $$3}'))
3636
mkfile_dir := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
3737
UNAME_S=$(shell uname -s)
3838

39-
## all : default task
39+
## all : default task (install cwl-utils in dev mode)
4040
all: dev
4141

42-
## help : print this help message and exit
42+
## help : print this help message and exit
4343
help: Makefile
4444
@sed -n 's/^##//p' $<
4545

46-
## install-dep : install most of the development dependencies via pip
46+
## cleanup : shortcut for "make sort_imports format flake8 diff_pydocstyle_report"
47+
cleanup: sort_imports format flake8 diff_pydocstyle_report
48+
49+
## install-dep : install most of the development dependencies via pip
4750
install-dep: install-dependencies
4851

4952
install-dependencies:
5053
pip install --upgrade $(DEVPKGS)
5154
pip install -r requirements.txt -r mypy-requirements.txt -r docs/requirements.txt
5255

53-
## install-deb-dep: install most of the dev dependencies via apt-get
56+
## install-deb-dep : install many of the dev dependencies via apt-get
5457
install-deb-dep:
5558
sudo apt-get install $(DEBDEVPKGS)
5659

57-
## install : install the ${MODULE} module and scripts
60+
## install : install the cwl-utils package and the scripts
5861
install: FORCE
5962
pip install .$(EXTRAS)
6063

61-
## dev : install the ${MODULE} module in dev mode
64+
## dev : install the cwl-utils package in dev mode
6265
dev: install-dep
6366
pip install -e .$(EXTRAS)
6467

65-
## dist : create a module package for distribution
68+
## dist : create a module package for distribution
6669
dist: dist/${MODULE}-$(VERSION).tar.gz
6770

6871
dist/${MODULE}-$(VERSION).tar.gz: $(SOURCES)
6972
python setup.py sdist bdist_wheel
7073

71-
## docs : make the docs
74+
## docs : make the docs
7275
docs: FORCE
7376
cd docs && $(MAKE) html
7477

75-
## clean : clean up all temporary / machine-generated files
78+
## clean : clean up all temporary / machine-generated files
7679
clean: FORCE
7780
rm -f ${MODILE}/*.pyc tests/*.pyc
7881
python setup.py clean --all || true
7982
rm -Rf .coverage
8083
rm -f diff-cover.html
8184

8285
# Linting and code style related targets
83-
## sorting imports using isort: https://github.com/timothycrosley/isort
86+
## sort_import : sorting imports using isort: https://github.com/timothycrosley/isort
8487
sort_imports: $(PYSOURCES)
8588
isort $^
8689

8790
remove_unused_imports: $(PYSOURCES)
8891
autoflake --in-place --remove-all-unused-imports $^
8992

9093
pep257: pydocstyle
91-
## pydocstyle : check Python code style
94+
## pydocstyle : check Python docstring style
9295
pydocstyle: $(PYSOURCES)
9396
pydocstyle --add-ignore=D100,D101,D102,D103 $^ || true
9497

9598
pydocstyle_report.txt: $(PYSOURCES)
9699
pydocstyle setup.py $^ > $@ 2>&1 || true
97100

101+
## diff_pydocstyle_report : check Python docstring style for changed files only
98102
diff_pydocstyle_report: pydocstyle_report.txt
99103
diff-quality --compare-branch=main --violations=pydocstyle --fail-under=100 $^
100104

101-
## format : check/fix all code indentation and formatting (runs black)
105+
## codespell : check for common misspellings
106+
codespell:
107+
codespell -w $(shell git ls-files | grep -v mypy-stubs)
108+
109+
## format : check/fix all code indentation and formatting (runs black)
102110
format: $(PYSOURCES)
103111
black $^
104112

105113
format-check: $(PYSOURCES)
106114
black --diff --check $^
107115

108-
## pylint : run static code analysis on Python code
116+
## pylint : run static code analysis on Python code
109117
pylint: $(PYSOURCES)
110118
pylint --msg-template="{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" \
111119
$^ -j0|| true
@@ -115,7 +123,7 @@ pylint_report.txt: $(PYSOURCES)
115123
$^ -j0> $@ || true
116124

117125
diff_pylint_report: pylint_report.txt
118-
diff-quality --violations=pylint pylint_report.txt
126+
diff-quality --compare-branch=main --violations=pylint pylint_report.txt
119127

120128
.coverage: testcov
121129

@@ -135,23 +143,23 @@ coverage-report: .coverage
135143
coverage report
136144

137145
diff-cover: coverage.xml
138-
diff-cover $^
146+
diff-cover --compare-branch=main $^
139147

140148
diff-cover.html: coverage.xml
141-
diff-cover $^ --html-report $@
149+
diff-cover --compare-branch=main $^ --html-report $@
142150

143-
## test : run the ${MODULE} test suite
151+
## test : run the cwl-utils test suite
144152
test: $(PYSOURCES)
145-
pytest ${PYTEST_EXTRA}
153+
python -m pytest -rs ${PYTEST_EXTRA}
146154

147-
## testcov : run the ${MODULE} test suite and collect coverage
155+
## testcov : run the cwl-utils test suite and collect coverage
148156
testcov: $(PYSOURCES)
149157
pytest --cov ${PYTEST_EXTRA}
150158

151159
sloccount.sc: $(PYSOURCES) Makefile
152160
sloccount --duplicates --wide --details $^ > $@
153161

154-
## sloccount : count lines of code
162+
## sloccount : count lines of code
155163
sloccount: $(PYSOURCES) Makefile
156164
sloccount $^
157165

@@ -161,19 +169,16 @@ list-author-emails:
161169

162170
mypy3: mypy
163171
mypy: $(filter-out setup.py,${PYSOURCES})
164-
if ! test -f $(shell python3 -c 'import ruamel.yaml; import os.path; print(os.path.dirname(ruamel.yaml.__file__))')/py.typed ; \
165-
then \
166-
rm -Rf typeshed/ruamel/yaml ; \
167-
ln -s $(shell python3 -c 'import ruamel.yaml; import os.path; print(os.path.dirname(ruamel.yaml.__file__))') \
168-
typeshed/ruamel/ ; \
169-
fi # if minimally required ruamel.yaml version is 0.15.99 or greater, than the above can be removed
170-
MYPYPATH=$$MYPYPATH:typeshed mypy $^
172+
MYPYPATH=$$MYPYPATH:mypy-stubs mypy $^
173+
174+
shellcheck: FORCE
175+
shellcheck release-test.sh
171176

172177
pyupgrade: $(PYSOURCES)
173178
pyupgrade --exit-zero-even-if-changed --py36-plus $^
174179

175180
release-test: FORCE
176-
git diff-index --quiet HEAD -- || ( echo You have uncommited changes, please commit them and try again; false )
181+
git diff-index --quiet HEAD -- || ( echo You have uncommitted changes, please commit them and try again; false )
177182
./release-test.sh
178183

179184
release: release-test

cwl_utils/cwl_v1_0_expression_refactor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1300,7 +1300,7 @@ def traverse_CommandLineTool(
13001300
) -> bool:
13011301
"""Extract any CWL Expressions within the given CommandLineTool into sibling steps."""
13021302
modified = False
1303-
# don't modifiy clt, modify step.run
1303+
# don't modify clt, modify step.run
13041304
target_clt = step.run
13051305
inputs = empty_inputs(clt)
13061306
if not step.id:
@@ -1720,7 +1720,7 @@ def cltool_step_outputs_to_workflow_outputs(
17201720
"""
17211721
Copy CommandLineTool outputs into the equivalent Workflow output parameters.
17221722
1723-
Connects the outputSources for each of the new output paramters to the step
1723+
Connects the outputSources for each of the new output parameters to the step
17241724
they came from.
17251725
"""
17261726
outputs = yaml.comments.CommentedSeq()

cwl_utils/cwl_v1_1_expression_refactor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1300,7 +1300,7 @@ def traverse_CommandLineTool(
13001300
) -> bool:
13011301
"""Extract any CWL Expressions within the given CommandLineTool into sibling steps."""
13021302
modified = False
1303-
# don't modifiy clt, modify step.run
1303+
# don't modify clt, modify step.run
13041304
target_clt = step.run
13051305
inputs = empty_inputs(clt)
13061306
if not step.id:
@@ -1720,7 +1720,7 @@ def cltool_step_outputs_to_workflow_outputs(
17201720
"""
17211721
Copy CommandLineTool outputs into the equivalent Workflow output parameters.
17221722
1723-
Connects the outputSources for each of the new output paramters to the step
1723+
Connects the outputSources for each of the new output parameters to the step
17241724
they came from.
17251725
"""
17261726
outputs = yaml.comments.CommentedSeq()

cwl_utils/cwl_v1_2_expression_refactor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1396,7 +1396,7 @@ def traverse_CommandLineTool(
13961396
) -> bool:
13971397
"""Extract any CWL Expressions within the given CommandLineTool into sibling steps."""
13981398
modified = False
1399-
# don't modifiy clt, modify step.run
1399+
# don't modify clt, modify step.run
14001400
target_clt = step.run
14011401
inputs = empty_inputs(clt)
14021402
if not step.id:
@@ -1816,7 +1816,7 @@ def cltool_step_outputs_to_workflow_outputs(
18161816
"""
18171817
Copy CommandLineTool outputs into the equivalent Workflow output parameters.
18181818
1819-
Connects the outputSources for each of the new output paramters to the step
1819+
Connects the outputSources for each of the new output parameters to the step
18201820
they came from.
18211821
"""
18221822
outputs = yaml.comments.CommentedSeq()

cwl_utils/parser/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def save(
142142
base_url: str = "",
143143
relative_uris: bool = True,
144144
) -> Any:
145-
"""Convert a given CWL object into a build-in typed object."""
145+
"""Convert a given CWL object into a built-in typed object."""
146146
if (
147147
isinstance(val, cwl_v1_0.Savable)
148148
or isinstance(val, cwl_v1_1.Savable)

cwl_utils/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def resolved_path(
168168
linked document. This function will
169169
1. Resolve the path, which means dot and double dot components are resolved
170170
2. Use the OS appropriate path resolution for local paths, and network
171-
apropriate resolution for network paths
171+
appropriate resolution for network paths
172172
173173
From https://github.com/rabix/sbpack/blob/b8404a0859ffcbe1edae6d8f934e51847b003320/sbpack/lib.py
174174
"""

typeshed/cachecontrol/__init__.pyi renamed to mypy-stubs/cachecontrol/__init__.pyi

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,4 @@ from typing import Any
66

77
from .wrapper import CacheControl as CacheControl
88

9-
#from .adapter import CacheControlAdapter as CacheControlAdapter
10-
#from .controller import CacheController as CacheController
11-
129
__email__ = ... # type: Any

mypy-stubs/cachecontrol/cache.pyi

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class BaseCache:
2+
def get(self, key: str) -> str | None: ...
3+
def set(self, key: str, value: str) -> None: ...
4+
def delete(self, key: str) -> None: ...
5+
def close(self) -> None: ...

0 commit comments

Comments
 (0)