CWL Format
CWL Format is a specification and a reference implementation for a very opinionated CWL code formatter.
It outputs CWL in a standardized YAML format. It has no settings or options because you have better things to do with your time. And because CWL Format is always correct.
This repository lists the formatting rules and also contains a Python implementation of the formatter.
pip install cwlformat
cwl-format unformatted.cwl > formatted.cwl
If you don't have a > py3.6 environment, you can use pipx:
pip install pipx # from your < py3.6 environment
pipx ensurepath # ensures CLI application directory is on your $PATH
pipx install cwlformat --python python3.7 #tells pipx to set up a Py3.7 env for this app
Use programmatically in Python by doing
from cwlformat.formatter import cwl_format
formatted_text = cwl_format(unformatted_text)
or
from cwlformat.formatter import stringify_dict
as_dict = load_yaml(unformatted_text)
formatted_str = stringify_dict(as_dict)
Rules
-
Only comment lines at the top of the file, including blank lines, before the actual CWL code are preserved. All other comments are lost. Do not use this if all comments in the YAML are important to you.
-
If the first line does not start with
#!/usr/bin/envthe line#!/usr/bin/env cwl-runneris added to the top of the file. -
All CWL fields are ordered systematically. The field order for specific fields have a defined precedence ("pinned fields"). Any fields not present in this file ("free fields") are printed after the pinned fields and ordered alphabetically.
-
A single blank line is added before the following fields if the parent structure is a process.
- inputs
- outputs
- steps
- requirements
- hints
- baseCommand
-
The pinned fields are defined in this YAML file.
-
Specific pinned field orderings are available for CommandLineTool, ExpressionTool and Workflow processes. All other types follow a generic pinned field list.
-
All strings that fit within 80 columns are expressed in flow style. Longer strings or strings with new lines are expressed in block style.
-
All lists and maps are expressed in block style
-
The ordering of all lists are preserved
-
Indentation is 2 spaces, including for lists
Conformance tests
A series of documents are found in the tests directory that can be used
to check correctness of a formatter. The files named original-* are the input files
and the files named formatted-* are the corresponding formatted documents. There
are a mixture of YAML and JSON input files. Formatted files are always YAML.
CWL Exploder
This takes as input a packed workflow (workflow with all steps in lined) and splits it recursively into parts.
cwl-explode formatted-atac-seq-pipeline.cwl expected-exploded-atac-seq.cwl
Results in the exploded parent workflow and 52 sub-components
Metadata
Release files for cwlformat 2022.2.18
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| cwlformat-2022.2.18.tar.gz | 5.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cwlformat-2022.2.18-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.2 kB
Release files / cwlformat-2022.2.18.tar.gz
| Download URL | cwlformat-2022.2.18.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6a30545f8b9fcef87248b1101faf81ca76ae36eb6d6540e9ef70b4ff219fed37
|
|
BLAKE2b-256 checksum How to use checksums |
180f670281f74eaffc2e011b2bc8295806526ddbe1654fa6669095b8bacb2007
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.29.1 CPython/3.8.3
|
Release files / cwlformat-2022.2.18-py3-none-any.whl
| Download URL | cwlformat-2022.2.18-py3-none-any.whl |
|---|---|
| Size | 10.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d3e2dca192ce10e703ed4eb0bae26539db08d8ddd7c6a6fe9d1406c3f1b53cda
|
|
BLAKE2b-256 checksum How to use checksums |
3b5699a7cf6ca8533695874cf804369221d03bf5e869a7e0b38acbf4dbe8deeb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.29.1 CPython/3.8.3
|
Security for cwlformat 2022.2.18
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.