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

Support in Trogon #50

Open
mgielda opened this issue Jan 3, 2024 · 3 comments
Open

Support in Trogon #50

mgielda opened this issue Jan 3, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@mgielda
Copy link

mgielda commented Jan 3, 2024

Recently I discovered Trogon (https://github.com/Textualize/trogon) which seems pretty incredible (look at their video demo, this is some great stuff). In short, it turns a well-defined CLI app into a discoverable TUI which shows you all the options, defaults, types etc, lets you choose from available choices etc.

Especially useful for large apps, less so for trivial ones. Still, I think it kind of shows why standardizing your argument parsing etc makes sense, and I am fully on board with cyclopts' ambition to do that using plain Python.

Trogon wraps around click, yet there is some success people have reported with Typer, and an ongoing effort towards enabling mainline support + docs. Trogon+Typer does not fully work for me yet (it crashes unexpectedly when trying to execute the resulting command), and I suspect this has to do with some minor differences between vanilla Click and Typer. In my disenchantment with Typer recently and having decided I was switching over to Cyclopts, I will most likely not get involved there.

But Trogon remains a cool tool and there are efforts to make it work with other stuff including e.g. argparse - BTW this is from the author of https://www.fresh2.dev/r/yapx/ which builds on top of Argparse and seems like a good tool to make a comparison against. That effort in Trogon has stalled a bit, and the yapx developer seems to have forked Trogon to provide TUI support for his argparse-based lib, but I'd potentially be happy to help resurrect the effort to make Trogon more generic and support adding Cyclopts.

As far as comparisons are concerned, besides yapx, it might also make sense to look at clize, but I digress...

I guess the main purpose of the issue is to ask you, do you think having support for Cyclopts in Trogon would be useful? I wouldn't want to push for it if you a) found this to be useless and/or b) thought it was fundamentally impossible to do due to the way Cyclopts is implemented as compared to Click/argparse (which I doubt). It most likely won't really require any changes to Cyclopts itself.

And a bit of nostalgia, the first time when I realized how awesome building CLIs in Python can be some years ago was while reading the plac docs for advanced usage and all the nifty tricks described there. I was going to ask what your thoughts were on adding an interactive prompt (which I think is the niftiest of the nifty tricks)... until I found you'd already added it. Awesome!

@BrianPugh
Copy link
Owner

I hadn't seen Trogon before, it looks very nice! I would love for Cyclopts to be compatible (it would actually help out one of my other projects, gnwmanager)! I think I'd want the following before investigating further:

  1. Get v2 in a state i'm happy with and let Cyclopts mature a little bit.
  2. Let trogon mature a little bit; if they support argparse, then I'd be much more optimistic it could also easily support Cyclopts since there would be an established API to hook into.

@mgielda
Copy link
Author

mgielda commented Jan 3, 2024

Oh man, awesome, have you seen Renode (https://github.com/renode/renode)? I didn't know you were even working on embedded stuff. STM32 is supported pretty well - take a look at the Zephyr Dashboard and scroll to the STMs. There are some interactive test results previews and Google Colabs even :)

As for trogon, yeah, I think for it to mature we'd have to give it a little push, since it seems like it's not a core project for @Textualize. I guess we'd need to prod the yapx dev to see whether they want to contribute their changes back to Trogon or should we consider theirs a hard fork. I think they did want to contribute, but reactions were slow, so they opted for forking.

Anyway will need to investigate more.

@BrianPugh
Copy link
Owner

minor update: I overhauled data-resolution in v2. Previously each section would derive (and fallback) data in adhoc manner. It's all centralized now. This would make a potential integration with trogon much easier now.

@BrianPugh BrianPugh added the enhancement New feature or request label Jan 18, 2024
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
None yet
Development

No branches or pull requests

2 participants