cylc-flow
cylc-flow copied to clipboard
Cylc Config json output mode
Add the following command to Cylc Config:
$ cylc config --json
Required for https://github.com/cylc/cylc-sphinx-extensions/pull/81.
Check List
- [x] I have read
CONTRIBUTING.mdand added my name as a Code Contributor. - [x] Contains logically grouped changes (else tidy your branch by rebase).
- [x] Does not contain off-topic changes (use other PRs for other changes).
- [x] Applied any dependency changes to both
setup.cfg(andconda-environment.ymlif present). - [x] Tests are included (or explain why tests are not needed).
- [x] Changelog entry included if this is a change that can affect users
- [x] Cylc-Doc pull request opened if required at cylc/cylc-doc/pull/XXXX.
- [x] If this is a bug fix, PR should be raised against the relevant
?.?.xbranch.
Lint failing
Drafted pending other work this not being a priority compared to bugfixes.
Workflow with implicit task foo
$ cylc config myworkflow -i '[runtime][foo]' --null-value=meow --json
Traceback (most recent call last):
File "~/.conda/envs/cylc8/bin/cylc", line 8, in <module>
sys.exit(main())
^^^^^^
File "~/github/cylc-flow/cylc/flow/scripts/cylc.py", line 703, in main
execute_cmd(command, *cmd_args)
File "~/github/cylc-flow/cylc/flow/scripts/cylc.py", line 334, in execute_cmd
entry_point.load()(*args)
File "~/github/cylc-flow/cylc/flow/terminal.py", line 298, in wrapper
wrapped_function(*wrapped_args, **wrapped_kwargs)
File "~/github/cylc-flow/cylc/flow/scripts/config.py", line 189, in main
asyncio.run(_main(parser, options, *ids))
File "~/.conda/envs/cylc8/lib/python3.11/asyncio/runners.py", line 190, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "~/.conda/envs/cylc8/lib/python3.11/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "~/.conda/envs/cylc8/lib/python3.11/asyncio/base_events.py", line 654, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "~/github/cylc-flow/cylc/flow/scripts/config.py", line 245, in _main
config.pcfg.idump(
File "~/github/cylc-flow/cylc/flow/parsec/config.py", line 186, in idump
self.jdump(mkeys, sparse, oneline, none_str, handle=handle)
File "~/github/cylc-flow/cylc/flow/parsec/config.py", line 215, in jdump
cfg.repl_val(cfg, None, none_str)
^^^^^^^^^^^^
AttributeError: 'dict' object has no attribute 'repl_val'
This PR could probably be merged now, however, IMO it's best to keep pairs of PRs open (i.e. unmerged) until the upstream PR has been merged as review comments there could force changes here. Will review together with the upstream PR when both are ready.
The upstream PR is currently a draft, so I'll mark this as draft for now to match.
I will get back to this one day, but it's a feature, not a bug...