Report program name as cwltool when invoked as cwl-runner (#1535)#2290
Open
arimu1 wants to merge 2 commits into
Open
Report program name as cwltool when invoked as cwl-runner (#1535)#2290arimu1 wants to merge 2 commits into
arimu1 wants to merge 2 commits into
Conversation
…kflow-language#1535) argparse defaults prog to os.path.basename(sys.argv[0]), so running cwltool through its cwl-runner entry point made --help and error messages say "usage: cwl-runner ...". Set prog="cwltool" explicitly so the reference implementation is always identified consistently, regardless of which entry point was used. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
mr-c
reviewed
Jun 18, 2026
| ) | ||
|
|
||
| parser = argparse.ArgumentParser( | ||
| prog="cwltool", |
Member
There was a problem hiding this comment.
How will this affect downstream users of cwltool, like Toil, Calrissian, Arvados, and others?
…guage#1535) Per review feedback: an unconditional prog="cwltool" would leak into downstream tools that reuse cwltool.argparser.arg_parser() as their base parser (e.g. Calrissian), changing their --help/usage program name. Scope the override to the actual invocation name: set prog="cwltool" only when invoked as the generic "cwl-runner" alias, otherwise leave it None so argparse's basename default is preserved. Toil and Arvados are unaffected either way (they build their own parsers). Added a test asserting a downstream invocation name is preserved.
Author
|
Good question — I checked the three:
To avoid that, I scoped the override to the actual entry-point name: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1535.
cwltoolis installed with acwl-runnerconsole-script entry point. Becauseargparsedefaultsprogtoos.path.basename(sys.argv[0]), invoking it through that alias made the help and error output identify the program ascwl-runner:Change
Set
prog="cwltool"explicitly on the top-levelArgumentParserincwltool/argparser.py, so the reference implementation is always identified consistently no matter which entry point launched it:This also applies to the usage line printed on argument errors.
Tests
Added
test_argparser_prog_is_cwltooltotests/test_toolargparse.py, which patchessys.argv[0]tocwl-runnerand assertsarg_parser().prog == "cwltool". Fulltest_toolargparse.pypasses (18);black/flake8/isortclean.This change was produced with the assistance of Claude Code (model: Claude Opus). It was reviewed by a human before submission.