Marimo as CLI: linking command line inputs to query parameters with Cyclopts and Pydantic #6483
liquidcarbon
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've been playing with this really nice, modern, low-dependency CLI tool called cyclopts.
Turns out it's quite easy to reuse pydantic or dataclass model that I've described for query parameters in #4960 as a CLI model.
The notebook can be used as usual, with interactive inputs, but you also get in-terminal documentation, where you can describe what it does, what inputs it takes and their type, etc.:
Complete example [molab link]:
<side-note>would be nice if molab preview actually took query params!</side-note>And now that CLI inputs plug into query params, you can test it programmatically, which might just fit into the use case of testing such notebooks I've been looking for in #5814
Of course, the intermediate step of query parameters is optional, and you can pass the CLI args into UI directly.
What are your thoughts? Should I make a PR adding docs to guides/scripts maybe?
P.S. I'm aware of
mo.cli_args- but this option is quite a bit more powerful.Beta Was this translation helpful? Give feedback.
All reactions