From 29d1e49c52f063f2f1454d5aa09b6c30025991d3 Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" Date: Tue, 31 Jan 2023 11:29:37 +0100 Subject: [PATCH 1/2] readthedocs: install graphviz --- .readthedocs.yml | 2 ++ Makefile | 4 ++-- cwltool/argparser.py | 11 +++++++---- cwltool/command_line_tool.py | 1 - cwltool/context.py | 2 +- cwltool/process.py | 7 ++----- cwltool/singularity.py | 12 +++++------- docs/index.rst | 1 + tox.ini | 5 ++--- 9 files changed, 22 insertions(+), 23 deletions(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 5a74019a3..cd1f44052 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -16,6 +16,8 @@ build: os: ubuntu-22.04 tools: python: "3.11" + apt_packages: + - graphviz python: install: diff --git a/Makefile b/Makefile index 62bd941ce..fc49a2935 100644 --- a/Makefile +++ b/Makefile @@ -25,9 +25,9 @@ MODULE=cwltool # `SHELL=bash` doesn't work for some, so don't use BASH-isms like # `[[` conditional expressions. PYSOURCES=$(wildcard ${MODULE}/**.py tests/*.py) setup.py -DEVPKGS=diff_cover pylint pep257 pydocstyle tox tox-pyenv \ +DEVPKGS=diff_cover pylint pep257 pydocstyle 'tox<4' tox-pyenv \ isort wheel autoflake pyupgrade bandit -rlint-requirements.txt\ - -rtest-requirements.txt -rmypy-requirements.txt + -rtest-requirements.txt -rmypy-requirements.txt -rdocs/requirements.txt DEBDEVPKGS=pep8 python-autopep8 pylint python-coverage pydocstyle sloccount \ python-flake8 python-mock shellcheck diff --git a/cwltool/argparser.py b/cwltool/argparser.py index c5df4f580..a7e58c463 100644 --- a/cwltool/argparser.py +++ b/cwltool/argparser.py @@ -742,6 +742,8 @@ def get_default_args() -> Dict[str, Any]: class FSAction(argparse.Action): + """Base action for our custom actions.""" + objclass: Optional[str] = None def __init__( @@ -778,6 +780,8 @@ def __call__( class FSAppendAction(argparse.Action): + """Appending version of the base action for our custom actions.""" + objclass: Optional[str] = None def __init__( @@ -832,11 +836,10 @@ class DirectoryAppendAction(FSAppendAction): class AppendAction(argparse.Action): - """An argparse action that clears the default values if any value is provided. + """An argparse action that clears the default values if any value is provided.""" - Attributes: - _called (bool): Initially set to ``False``, changed if any value is appended. - """ + _called: bool + """Initially set to ``False``, changed if any value is appended.""" def __init__( self, diff --git a/cwltool/command_line_tool.py b/cwltool/command_line_tool.py index deefcc922..898a5a842 100644 --- a/cwltool/command_line_tool.py +++ b/cwltool/command_line_tool.py @@ -253,7 +253,6 @@ def revmap_file( outside the container. Recognizes files in the pathmapper or remaps internal output directories to the external directory. """ - # builder.outdir is the inner (container/compute node) output directory # outdir is the outer (host/storage system) output directory diff --git a/cwltool/context.py b/cwltool/context.py index 7c3dfd211..1c03a8e16 100644 --- a/cwltool/context.py +++ b/cwltool/context.py @@ -79,7 +79,7 @@ def log_handler( def set_log_dir(outdir: str, log_dir: str, subdir_name: str) -> str: - """Default handler for setting the log directory.""" + """Set the log directory.""" if log_dir == "": return outdir else: diff --git a/cwltool/process.py b/cwltool/process.py index 6b15fa433..1ec8ca985 100644 --- a/cwltool/process.py +++ b/cwltool/process.py @@ -1203,10 +1203,8 @@ def scandeps( urljoin: Callable[[str, str], str] = urllib.parse.urljoin, nestdirs: bool = True, ) -> MutableSequence[CWLObjectType]: - - """Given a CWL document or input object, search for dependencies - (references to external files) of 'doc' and return them as a list - of File or Directory objects. + """ + Search for external files references in a CWL document or input object. Looks for objects with 'class: File' or 'class: Directory' and adds them to the list of dependencies. @@ -1224,7 +1222,6 @@ def scandeps( produce the same relative file system locations. :returns: A list of File or Directory dependencies """ - r: MutableSequence[CWLObjectType] = [] if isinstance(doc, MutableMapping): if "id" in doc: diff --git a/cwltool/singularity.py b/cwltool/singularity.py index ac6651357..887569396 100644 --- a/cwltool/singularity.py +++ b/cwltool/singularity.py @@ -32,15 +32,13 @@ def get_version() -> Tuple[List[int], str]: """ - Parse the output of 'singularity --version' to determine the singularity flavor / - distribution (singularity, singularity-ce or apptainer) and the singularity version. + Parse the output of 'singularity --version' to determine the flavor and version. + Both pieces of information will be cached. - Returns - ------- - A tuple containing: - - A tuple with major and minor version numbers as integer. - - A string with the name of the singularity flavor. + :returns: A tuple containing: + - A tuple with major and minor version numbers as integer. + - A string with the name of the singularity flavor. """ global _SINGULARITY_VERSION # pylint: disable=global-statement global _SINGULARITY_FLAVOR # pylint: disable=global-statement diff --git a/docs/index.rst b/docs/index.rst index f816cac55..2e718f176 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -9,6 +9,7 @@ CWLProv pythonversions processgen + autoapi/index Indices and tables ================== diff --git a/tox.ini b/tox.ini index bd675b40d..66b472e5c 100644 --- a/tox.ini +++ b/tox.ini @@ -61,8 +61,7 @@ setenv = py3{6,7,8,9,10,11}-unit: LC_ALL = C.UTF-8 commands_pre = - py3{6,7,8,9,10,11}-unit: python -m pip install -U pip setuptools wheel - py311-lintreadme: python -m build --outdir {distdir} + py311-lintreadme: python -m build --outdir ${TOX_PACKAGE} commands = py3{6,7,8,9,10,11}-unit: make coverage-report coverage.xml PYTEST_EXTRA={posargs} @@ -72,7 +71,7 @@ commands = py37-mypy: make mypy_3.6 py311-shellcheck: make shellcheck py311-pydocstyle: make diff_pydocstyle_report - py311-lintreadme: twine check {distdir}/* + py311-lintreadme: twine check ${TOX_PACKAGE}/* skip_install = py3{6,7,8,9,10,11}-{bandit,lint,mypy,shellcheck,pydocstyle,lintreadme}: true From aff6c1fd3acabd8301f7ba1303b5585d7411f694 Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" Date: Tue, 31 Jan 2023 12:10:40 +0100 Subject: [PATCH 2/2] tox-gh-actions is not yet compatible with tox>=4 --- .github/workflows/ci-tests.yml | 6 +++--- README.rst | 2 +- tox.ini | 5 +++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index a373b5582..47df6cbf9 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -57,7 +57,7 @@ jobs: - name: Upgrade setuptools and install tox run: | pip install -U pip setuptools wheel - pip install "tox<4" tox-gh-actions + pip install "tox<4" "tox-gh-actions<3" - name: MyPy cache if: ${{ matrix.step == 'mypy' }} @@ -102,7 +102,7 @@ jobs: - name: Upgrade setuptools and install tox run: | pip install -U pip setuptools wheel - pip install tox tox-gh-actions + pip install "tox<4" "tox-gh-actions<3" - if: ${{ matrix.step == 'pydocstyle' && github.event_name == 'pull_request'}} name: Create local branch for diff-quality for PRs @@ -224,7 +224,7 @@ jobs: - name: Upgrade setuptools and install tox run: | pip install -U pip setuptools wheel - pip install tox tox-gh-actions + pip install "tox<4" "tox-gh-actions<3" # # docker for mac install is not currently stable # - name: 'SETUP MacOS: load Homebrew cache' # uses: actions/cache@v3 diff --git a/README.rst b/README.rst index 09bfa52ee..b65d74bca 100644 --- a/README.rst +++ b/README.rst @@ -716,7 +716,7 @@ To run the basic tests after installing `cwltool` execute the following: To run various tests in all supported Python environments, we use `tox `_. To run the test suite in all supported Python environments first clone the complete code repository (see the ``git clone`` instructions above) and then run the following in the terminal: -``pip install tox; tox -p`` +``pip install "tox<4"; tox -p`` List of all environment can be seen using: ``tox --listenvs`` diff --git a/tox.ini b/tox.ini index 66b472e5c..bd675b40d 100644 --- a/tox.ini +++ b/tox.ini @@ -61,7 +61,8 @@ setenv = py3{6,7,8,9,10,11}-unit: LC_ALL = C.UTF-8 commands_pre = - py311-lintreadme: python -m build --outdir ${TOX_PACKAGE} + py3{6,7,8,9,10,11}-unit: python -m pip install -U pip setuptools wheel + py311-lintreadme: python -m build --outdir {distdir} commands = py3{6,7,8,9,10,11}-unit: make coverage-report coverage.xml PYTEST_EXTRA={posargs} @@ -71,7 +72,7 @@ commands = py37-mypy: make mypy_3.6 py311-shellcheck: make shellcheck py311-pydocstyle: make diff_pydocstyle_report - py311-lintreadme: twine check ${TOX_PACKAGE}/* + py311-lintreadme: twine check {distdir}/* skip_install = py3{6,7,8,9,10,11}-{bandit,lint,mypy,shellcheck,pydocstyle,lintreadme}: true