Skip to content

Commit e1a9100

Browse files
authored
Update README and other docs (#1778)
Include README in the Read The Docs site Pin tox before 4.0 for now Move the CLI options to a new page Headings formatting fix Fix udocker/singularity examples Explicit section for Singularity Many other docstring cleanups throughout the codebase
1 parent a43840c commit e1a9100

Some content is hidden

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

41 files changed

+415
-262
lines changed

.github/workflows/ci-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
- name: Upgrade setuptools and install tox
6363
run: |
6464
pip install -U pip setuptools wheel
65-
pip install tox tox-gh-actions
65+
pip install "tox<4" tox-gh-actions
6666
6767
- name: MyPy cache
6868
if: ${{ matrix.step == 'mypy' }}

.readthedocs.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,12 @@ sphinx:
1212
# Optionally build your docs in additional formats such as PDF and ePub
1313
formats: all
1414

15-
# Optionally set the version of Python and requirements required to build your docs
15+
build:
16+
os: ubuntu-22.04
17+
tools:
18+
python: "3.11"
19+
1620
python:
17-
version: 3.7
1821
install:
1922
- requirements: docs/requirements.txt
2023
- method: pip

README.rst

Lines changed: 62 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
==================================================================
2-
Common Workflow Language tool description reference implementation
3-
==================================================================
1+
#############################################################################################
2+
``cwltool``: The reference reference implementation of the Common Workflow Language standards
3+
#############################################################################################
44

55
|Linux Status| |Coverage Status| |Docs Status|
66

@@ -46,11 +46,12 @@ Quay.io (Docker): |Quay.io Container|
4646
:target: https://cwltool.readthedocs.io/en/latest/?badge=latest
4747
:alt: Documentation Status
4848

49-
This is the reference implementation of the Common Workflow Language. It is
50-
intended to be feature complete and provide comprehensive validation of CWL
49+
This is the reference implementation of the `Common Workflow Language open
50+
standards <https://www.commonwl.org/>`_. It is intended to be feature complete
51+
and provide comprehensive validation of CWL
5152
files as well as provide other tools related to working with CWL.
5253

53-
This is written and tested for
54+
``cwltool`` is written and tested for
5455
`Python <https://www.python.org/>`_ ``3.x {x = 6, 7, 8, 9, 10, 11}``
5556

5657
The reference implementation consists of two packages. The ``cwltool`` package
@@ -64,11 +65,14 @@ default CWL interpreter installed on a host.
6465
``cwltool`` is provided by the CWL project, `a member project of Software Freedom Conservancy <https://sfconservancy.org/news/2018/apr/11/cwl-new-member-project/>`_
6566
and our `many contributors <https://github.com/common-workflow-language/cwltool/graphs/contributors>`_.
6667

68+
.. contents:: Table of Contents
69+
70+
*******
6771
Install
68-
-------
72+
*******
6973

7074
``cwltool`` packages
71-
^^^^^^^^^^^^^^^^^^^^
75+
====================
7276

7377
Your operating system may offer cwltool directly. For `Debian <https://tracker.debian.org/pkg/cwltool>`_, `Ubuntu <https://launchpad.net/ubuntu/+source/cwltool>`_,
7478
and similar Linux distribution try
@@ -112,19 +116,19 @@ If installing alongside another CWL implementation (like ``toil-cwl-runner`` or
112116
pip install cwltool
113117
114118
MS Windows users
115-
^^^^^^^^^^^^^^^^
119+
================
116120

117-
1. Install `"Windows Subsystem for Linux 2" (WSL2) and Docker Desktop <https://docs.docker.com/docker-for-windows/wsl/#prerequisites>`_
118-
2. Install `Debian from the Microsoft Store <https://www.microsoft.com/en-us/p/debian/9msvkqc78pk6>`_
119-
3. Set Debian as your default WSL 2 distro: ``wsl --set-default debian``.
120-
4. Return to the Docker Desktop, choose `Settings → Resources → WSL Integration <https://docs.docker.com/desktop/windows/images/wsl2-choose-distro.png>`_ and under "Enable integration with additional distros" select "Debian",
121-
5. Reboot if you have not yet already.
122-
6. Launch Debian and follow the Linux instructions above (``apt-get install cwltool`` or use the ``venv`` method)
121+
1. `Install Windows Subsystem for Linux 2 and Docker Desktop <https://docs.docker.com/docker-for-windows/wsl/#prerequisites>`_.
122+
2. `Install Debian from the Microsoft Store <https://www.microsoft.com/en-us/p/debian/9msvkqc78pk6>`_.
123+
3. Set Debian as your default WSL 2 distro: ``wsl --set-default debian``.
124+
4. Return to the Docker Desktop, choose ``Settings````Resources````WSL Integration`` and under "Enable integration with additional distros" select "Debian",
125+
5. Reboot if you have not yet already.
126+
6. Launch Debian and follow the Linux instructions above (``apt-get install cwltool`` or use the ``venv`` method)
123127

124128
Network problems from within WSL2? Try `these instructions <https://github.com/microsoft/WSL/issues/4731#issuecomment-702176954>`_ followed by ``wsl --shutdown``.
125129

126130
``cwltool`` development version
127-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
131+
===============================
128132

129133
Or you can skip the direct ``pip`` commands above and install the latest development version of ``cwltool``:
130134

@@ -140,33 +144,42 @@ maintain which implementation ``cwl-runner`` points to via a symbolic file
140144
system link or `another facility <https://wiki.debian.org/DebianAlternatives>`_.
141145

142146
Recommended Software
143-
^^^^^^^^^^^^^^^^^^^^
147+
====================
148+
149+
We strongly suggested to have the following installed:
150+
151+
* One of the following software container engines
144152

145-
You may also want to have the following installed:
146-
- `node.js <https://nodejs.org/en/download/>`_
147-
- Docker, udocker, or Singularity (optional)
153+
* `Podman <https://podman.io/getting-started/installation>`_
154+
* `Docker <https://docs.docker.com/engine/install/>`_
155+
* Singularity/Apptainer: See `Using Singularity`_
156+
* udocker: See `Using uDocker`_
157+
158+
* `node.js <https://nodejs.org/en/download/>`_ for evaluating CWL Expressions quickly
159+
(required for `udocker` users, optional but recommended for the other container engines).
148160

149161
Without these, some examples in the CWL tutorials at http://www.commonwl.org/user_guide/ may not work.
150162

163+
***********************
151164
Run on the command line
152-
-----------------------
165+
***********************
153166

154167
Simple command::
155168

156-
cwl-runner [tool-or-workflow-description] [input-job-settings]
169+
cwl-runner my_workflow.cwl my_inputs.yaml
157170

158171
Or if you have multiple CWL implementations installed and you want to override
159172
the default cwl-runner then use::
160173

161-
cwltool [tool-or-workflow-description] [input-job-settings]
174+
cwltool my_workflow.cwl my_inputs.yml
162175

163-
You can set cwltool options in the environment with CWLTOOL_OPTIONS,
176+
You can set cwltool options in the environment with ``CWLTOOL_OPTIONS``,
164177
these will be inserted at the beginning of the command line::
165178

166179
export CWLTOOL_OPTIONS="--debug"
167180

168181
Use with boot2docker on macOS
169-
-----------------------------
182+
=============================
170183
boot2docker runs Docker inside a virtual machine, and it only mounts ``Users``
171184
on it. The default behavior of CWL is to create temporary directories under e.g.
172185
``/Var`` which is not accessible to Docker containers.
@@ -177,22 +190,24 @@ and ``--tmp-outdir-prefix`` to somewhere under ``/Users``::
177190
$ cwl-runner --tmp-outdir-prefix=/Users/username/project --tmpdir-prefix=/Users/username/project wc-tool.cwl wc-job.json
178191

179192
Using uDocker
180-
-------------
193+
=============
181194

182195
Some shared computing environments don't support Docker software containers for technical or policy reasons.
183-
As a workaround, the CWL reference runner supports using the ``udocker`` program on Linux using ``--udocker``
184-
<https://github.com/indigo-dc/udocker>.
196+
As a workaround, the CWL reference runner supports using the `udocker <https://github.com/indigo-dc/udocker>`_
197+
program on Linux using ``--udocker``.
185198

186199
udocker installation: https://indigo-dc.github.io/udocker/installation_manual.html
187200

188-
Run `cwltool` just as you usually would, but with the new option, e.g., from the conformance tests
201+
Run `cwltool` just as you usually would, but with ``--udocker`` prior to the workflow path:
189202

190203
.. code:: bash
191204
192205
cwltool --udocker https://github.com/common-workflow-language/common-workflow-language/raw/main/v1.0/v1.0/test-cwl-out2.cwl https://github.com/common-workflow-language/common-workflow-language/raw/main/v1.0/v1.0/empty.json
193206
207+
As was mentioned in the `Recommended Software`_ section,
208+
194209
Using Singularity
195-
-----------------
210+
=================
196211

197212
``cwltool`` can also use `Singularity <https://github.com/hpcng/singularity/releases/>`_ version 2.6.1
198213
or later as a Docker container runtime.
@@ -210,7 +225,7 @@ Example
210225
cwltool --singularity https://github.com/common-workflow-language/common-workflow-language/raw/main/v1.0/v1.0/cat3-tool-mediumcut.cwl https://github.com/common-workflow-language/common-workflow-language/raw/main/v1.0/v1.0/cat-job.json
211226
212227
Running a tool or workflow from remote or local locations
213-
---------------------------------------------------------
228+
=========================================================
214229

215230
``cwltool`` can run tool and workflow descriptions on both local and remote
216231
systems via its support for HTTP[S] URLs.
@@ -221,11 +236,11 @@ is referenced and that document isn't found in the current directory, then the
221236
following locations will be searched:
222237
http://www.commonwl.org/v1.0/CommandLineTool.html#Discovering_CWL_documents_on_a_local_filesystem
223238

224-
You can also use `cwldep <https://github.com/common-workflow-language/cwldep>`
239+
You can also use `cwldep <https://github.com/common-workflow-language/cwldep>`_
225240
to manage dependencies on external tools and workflows.
226241

227242
Overriding workflow requirements at load time
228-
---------------------------------------------
243+
=============================================
229244

230245
Sometimes a workflow needs additional requirements to run in a particular
231246
environment or with a particular dataset. To avoid the need to modify the
@@ -269,7 +284,7 @@ Override identifiers are relative to the top-level workflow document.
269284
270285
271286
Combining parts of a workflow into a single document
272-
----------------------------------------------------
287+
====================================================
273288

274289
Use ``--pack`` to combine a workflow made up of multiple files into a
275290
single compound document. This operation takes all the CWL files
@@ -285,7 +300,7 @@ document. The top-level workflow is named ``#main``.
285300
286301
287302
Running only part of a workflow
288-
-------------------------------
303+
===============================
289304

290305
You can run a partial workflow with the ``--target`` (``-t``) option. This
291306
takes the name of an output parameter, workflow step, or input
@@ -315,7 +330,7 @@ selected targets.
315330
316331
317332
Visualizing a CWL document
318-
--------------------------
333+
==========================
319334

320335
The ``--print-dot`` option will print a file suitable for Graphviz ``dot`` program. Here is a bash onliner to generate a Scalable Vector Graphic (SVG) file:
321336

@@ -324,7 +339,7 @@ The ``--print-dot`` option will print a file suitable for Graphviz ``dot`` progr
324339
cwltool --print-dot my-wf.cwl | dot -Tsvg > my-wf.svg
325340
326341
Modeling a CWL document as RDF
327-
------------------------------
342+
==============================
328343

329344
CWL documents can be expressed as RDF triple graphs.
330345

@@ -334,7 +349,7 @@ CWL documents can be expressed as RDF triple graphs.
334349
335350
336351
Environment Variables in cwltool
337-
--------------------------------
352+
================================
338353

339354
This reference implementation supports several ways of setting
340355
environment variables for tools, in addition to the standard
@@ -573,7 +588,7 @@ at the following links:
573588
- `Initial cwltool Integration Pull Request <https://github.com/common-workflow-language/cwltool/pull/214>`__
574589

575590
Use with GA4GH Tool Registry API
576-
--------------------------------
591+
================================
577592

578593
Cwltool can launch tools directly from `GA4GH Tool Registry API`_ endpoints.
579594

@@ -596,7 +611,7 @@ For this example, grab the test.json (and input file) from https://github.com/Ca
596611
.. _`GA4GH Tool Registry API`: https://github.com/ga4gh/tool-registry-schemas
597612

598613
Running MPI-based tools that need to be launched
599-
------------------------------------------------
614+
================================================
600615

601616
Cwltool supports an extension to the CWL spec
602617
``http://commonwl.org/cwltool#MPIRequirement``. When the tool
@@ -669,7 +684,7 @@ given in the following table; all are optional.
669684

670685

671686
Enabling Fast Parser (experimental)
672-
-----------------------------------
687+
===================================
673688

674689
For very large workflows, `cwltool` can spend a lot of time in
675690
initialization, before the first step runs. There is an experimental
@@ -682,12 +697,12 @@ initialization overhead, however as of this writing it has several limitations:
682697

683698
- Several other cases fail, as documented in https://github.com/common-workflow-language/cwltool/pull/1720
684699

685-
===========
700+
***********
686701
Development
687-
===========
702+
***********
688703

689704
Running tests locally
690-
---------------------
705+
=====================
691706

692707
- Running basic tests ``(/tests)``:
693708

@@ -719,7 +734,7 @@ program
719734
Instructions for running these tests can be found in the Common Workflow Language Specification repository at https://github.com/common-workflow-language/common-workflow-language/blob/main/CONFORMANCE_TESTS.md .
720735

721736
Import as a module
722-
------------------
737+
==================
723738

724739
Add
725740

@@ -743,7 +758,7 @@ The easiest way to use cwltool to run a tool or workflow from Python is to use a
743758
744759
745760
CWL Tool Control Flow
746-
---------------------
761+
=====================
747762

748763
Technical outline of how cwltool works internally, for maintainers.
749764

@@ -801,9 +816,8 @@ Technical outline of how cwltool works internally, for maintainers.
801816
Docker container, waits for it to complete, collects output, and makes
802817
the output callback.
803818

804-
805819
Extension points
806-
----------------
820+
================
807821

808822
The following functions can be passed to main() to override or augment
809823
the listed behaviors.

cwltool/argparser.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -977,15 +977,16 @@ def generate_parser(
977977
urljoin: Callable[[str, str], str] = urllib.parse.urljoin,
978978
base_uri: str = "",
979979
) -> argparse.ArgumentParser:
980-
toolparser.description = tool.tool.get("doc", None)
980+
"""Generate an ArgumentParser for the given CWL Process."""
981+
toolparser.description = tool.tool.get("doc", tool.tool.get("label", None))
981982
toolparser.add_argument("job_order", nargs="?", help="Job input json file")
982983
namemap["job_order"] = "job_order"
983984

984985
for inp in tool.tool["inputs"]:
985986
name = shortname(inp["id"])
986987
namemap[name.replace("-", "_")] = name
987988
inptype = inp["type"]
988-
description = inp.get("doc", "")
989+
description = inp.get("doc", inp.get("label", ""))
989990
default = inp.get("default", None)
990991
add_argument(
991992
toolparser,

0 commit comments

Comments
 (0)