Skip to content

Implement automatic "--no-*" boolean CLI params - #134

Open
pont-us wants to merge 8 commits into
mainfrom
pont-us/130-boolean-cli
Open

pont-us wants to merge 8 commits into
mainfrom
pont-us/130-boolean-cli

Conversation

@pont-us

@pont-us pont-us commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

Closes Issue #130.

For any boolean notebook parameter, xcengine now automatically parses not only a corresponding CLI parameter but also its inverse, so e.g. a parameter defined as my_param: bool = True in the notebook can be set to False with the CLI argument --no-my-param. (The CLI argument --my-param to set my_param to True is, of course, still supported.)

To do:

  • Implement corresponding changes in CWL generation
  • Implement inverted environment variables
  • Ensure full test coverage
  • Document the new feature
  • Update changelog

See Issue #130.

For any boolean notebook parameter, xcengine now automatically
parses not only a corresponding CLI parameter but also its
inverse, so e.g. a parameter defined as `my_param: bool = True`
in the notebook can be set to False with the CLI argument
--no-my-param. (The CLI argument --my-param to set my_param to
True is, of course, still supported.)

The corresponding changes to the CWL generation code have not yet
been implemented.
@codecov

codecov Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.51%. Comparing base (c306795) to head (3dec21e).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #134      +/-   ##
==========================================
+ Coverage   98.46%   98.51%   +0.05%     
==========================================
  Files           6        6              
  Lines         780      810      +30     
  Branches      100      110      +10     
==========================================
+ Hits          768      798      +30     
  Misses          8        8              
  Partials        4        4              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

See Issue #130.

As already done for the CLI interface, the environment variable
interface for setting parameters now supports automatically derived
"no_"-prefixed variables for every boolean parameter.
@pont-us
pont-us marked this pull request as ready for review December 1, 2026 10:59
@pont-us
pont-us requested a review from Hneuschmidt December 1, 2026 11:04
Comment thread docs/notebook.md

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In which case do users actually interact with / see the no_<param_name> form generated by xcengine? At first glance I was confused that the description focuses on these, where I would have considered that an implementation detail. Isn't the interesting part, that the --no-<param-name> command line flag is added to the Docker images and EOAPs?

As a small comment, I would explicitly say "Container images" if someone else trips up on that for a second, like I did (what images does xcengine produce?)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Hneuschmidt I agree on "container images" -- fixed. Regarding parameter naming, it gets a little complicated because there are several layers and several ways of interacting with a generated script or image. If you have a boolean variable my_param in the parameters cell:

  • In the notebook code, there is of course no no_my_param (unless explicitly declared).
  • When parsing command-line arguments to the script generated from the notebook, the xcengine code understands the arguments --my-param and --no-my-param.
  • When parsing environment variables, the xcengine code understands xce_my_param and xce_no_my_param. (It strikes me now that I don't think I've documented environment variable parameter parsing at all! But so far I don't think that it was needed.)
  • In the CWL CommandLineTool definition. my_param and no_my_param are defined, but I think that in this case you're right that the user is unlikely to see them.
  • In the CWL Workflow definition, my_param and no_my_param are also defined. A user of the EOAP is likely to encounter these indirectly:
    • If running with cwltool or some other CWL runner, they are set with their CWL names if a YAML parameter value file is provided, and with --my_param and --no_my_param on the command line. (cwltool doesn't perform underscore-to-hyphen substitution, but does use a double hyphen as an argument prefix.)
    • If running on an EOAP platform, I'd expect them to see the names my_param and no_my_param in whatever user interface is provided to OGC API -- Processes (e.g. eozilla-app).

That level of detail in the docs might be off-putting for users, though. I'll think about how to improve the current description without making it too tedious.

@pont-us

pont-us commented Dec 1, 2026

Copy link
Copy Markdown
Member Author

@Hneuschmidt By the way, while checking details for my response above I discovered a serious bug in the inverted-parameter implementation which fortunately had a very simple fix. See commit 3dec21e, especially the code comments.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants