common-workflow-language / cwl-utils

Python utilities for CWL
https://cwl-utils.readthedocs.io/
Apache License 2.0
36 stars 18 forks source link

ruamel.yaml doesn't support yaml.dump() #285

Open alexiswl opened 9 months ago

alexiswl commented 9 months ago

cwl-utils requirements uses less than <0.19

However yaml.dump was deprecated in version 0.18 and is not supported.

Steps to reproduce

# Install working

pip install cwl-utils==0.32
pip install ruamel.yaml==0.17.40

## Run GraphSplit
cwl-graph-split --outdir workflow/ pipeline.cwl.json 

## Install failing
pip install ruamel.yaml==0.18.0

## Run Graph Split
cwl-graph-split --outdir workflow/ pipeline.cwl.json 

Gives

Click to expand! ```pytb Traceback (most recent call last): File "/media/UMCCR/Projects/202402/schema-testing/venv/lib/python3.11/site-packages/cwl_utils/graph_split.py", line 180, in rewrite return rewrite_schemadef(document) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/media/UMCCR/Projects/202402/schema-testing/venv/lib/python3.11/site-packages/cwl_utils/graph_split.py", line 227, in rewrite_schemadef dump([entry], entry_handle, Dumper=RoundTripDumper) File "/media/UMCCR/Projects/202402/schema-testing/venv/lib/python3.11/site-packages/ruamel/yaml/main.py", line 1229, in dump error_deprecation('dump', 'dump', arg="typ='unsafe', pure=True") File "/media/UMCCR/Projects/202402/schema-testing/venv/lib/python3.11/site-packages/ruamel/yaml/main.py", line 1017, in error_deprecation sys.exit(1) SystemExit: 1 The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/media/UMCCR/Projects/202402/schema-testing/venv/lib/python3.11/site-packages/cwl_utils/graph_split.py", line 182, in rewrite imports.update(rewrite(value, doc_id)) ^^^^^^^^^^^^^^^^^^^^^^ File "/media/UMCCR/Projects/202402/schema-testing/venv/lib/python3.11/site-packages/cwl_utils/graph_split.py", line 135, in rewrite imports.update(rewrite(entry, doc_id)) ^^^^^^^^^^^^^^^^^^^^^^ File "/media/UMCCR/Projects/202402/schema-testing/venv/lib/python3.11/site-packages/cwl_utils/graph_split.py", line 139, in rewrite with SourceLine(document, key, Exception): File "/media/UMCCR/Projects/202402/schema-testing/venv/lib/python3.11/site-packages/schema_salad/sourceline.py", line 249, in __exit__ raise self.makeError(str(exc_value)) from exc_value Exception: pipeline.cwl.json:208:11: 1 The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/media/UMCCR/Projects/202402/schema-testing/venv/bin/cwl-graph-split", line 8, in sys.exit(main()) ^^^^^^ File "/media/UMCCR/Projects/202402/schema-testing/venv/lib/python3.11/site-packages/cwl_utils/graph_split.py", line 65, in main sys.exit(run(sys.argv[1:])) ^^^^^^^^^^^^^^^^^ File "/media/UMCCR/Projects/202402/schema-testing/venv/lib/python3.11/site-packages/cwl_utils/graph_split.py", line 73, in run graph_split( File "/media/UMCCR/Projects/202402/schema-testing/venv/lib/python3.11/site-packages/cwl_utils/graph_split.py", line 113, in graph_split imports = rewrite(entry, entry_id) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/media/UMCCR/Projects/202402/schema-testing/venv/lib/python3.11/site-packages/cwl_utils/graph_split.py", line 139, in rewrite with SourceLine(document, key, Exception): File "/media/UMCCR/Projects/202402/schema-testing/venv/lib/python3.11/site-packages/schema_salad/sourceline.py", line 249, in __exit__ raise self.makeError(str(exc_value)) from exc_value Exception: pipeline.cwl.json:208:11: 1 ```

pipeline.zip

mr-c commented 9 months ago

Yep, https://github.com/common-workflow-language/cwl-utils/blob/e3f070429b85b1ee547deb2b70d82d8857882f39/cwl_utils/graph_split.py#L227 should be changed to use the yaml_dump function or similar