Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make RuntimeOptions Usable From Python API #1097

Closed
austinmatherne-wk opened this issue Feb 27, 2024 · 0 comments · Fixed by #1177
Closed

Make RuntimeOptions Usable From Python API #1097

austinmatherne-wk opened this issue Feb 27, 2024 · 0 comments · Fixed by #1177
Labels
enhancement New feature or request

Comments

@austinmatherne-wk
Copy link
Contributor

What should we change and why?

In our previous work (see PR #828), we introduced the RuntimeOptions class. This development was aimed at decoupling command-line argument parsing from controller construction. The RuntimeOptions class is instantiated and utilized to initialize the CntlrCmdLine class directly within the CntlrCmdLine module.

The current implementation limits the RuntimeOptions class's utility to only the CntlrCmdLine class. This limitation prevents its use with the Python API with the underlying base Cntlr class.

To address this, we should allow both the Cntlr and CntlrCmdLine constructors to accept the RuntimeOptions class as an optional named field. If it's provided, the other parameters must either not be set or match the values in RuntimeOptions (if they don't, a ValueError should be raised).

There's additional handling in CntlrCmdLine.py for preloading plugins and configuring controller logging. It should be possible to do this for the base Cntlr class from a single function that takes RuntimeOptions.

With this work a user should be able to:

  1. Create and configure an instance of RuntimeOptions.
  2. Call the function to create and setup a Cntlr from the RuntimeOptions instance.
  3. Call the run method of the Cntlr instance to execute validation, generate renderers, or whatever else they configured in the options class.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Resolved
Development

Successfully merging a pull request may close this issue.

1 participant