-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Gooey with Click https://github.com/mitsuhiko/click ? #135
Comments
@pombredanne That the first I've ever heard of Click. The composable decorator approach it takes is pretty interesting. According to the docs, its internals are actually a fork of optparse, which in turn has similar conventions to argparse (e.g. types, dests, metavars, etc..), so.. I imagine it wouldn't be too difficult. |
@chriskiehl I use it in a few project after having used optparse, argparse, baker, docopt, cliff and several other and I find it working better for me. For instance here: https://github.com/nexB/scancode-toolkit/blob/a967fc768f8f9c39e066982eb5015fcf3b2952d5/src/scancode/cli.py#L235 I am not all alone there. See some of the hits here https://github.com/search?l=python&q=import+click+command&ref=searchresults&type=Code&utf8=%E2%9C%93 and there https://pypi.python.org/pypi?%3Aaction=search&term=%22Click+%22&submit=search I cannot say I blindly use any code from pocoo and @mitsuhiko but code from this provenance definitely has been working for me and is usually not too shaby... and way better than anything I can write :) Now, what would be the best approach? I do not think parsing the Python sources would make sense with Click. If so where would you plug that in? |
Gooey doesn't really parse anything. It uses good ol' fashion introspection. Being that the internals are forked from optparse, I'd wager that the method would be quite the same as the one for argparse: monkey patch its However, having only skimmed the docs, that would be my best uninformed guess at a starting point. |
@chriskiehl commented 17 hours ago
I thought that you were parsing source code based on this:
|
Ha! Yeah, I neglected to say anymore : ) It doesn't parse anything... anymore. Gooey originally grew out of me messing around with the ast, so there is certainly some vestigial parsing code in there. But now it just patches the I have a branch sitting locally that finally cleans up all the cruft, but.. alas.. time. |
👍 |
I am also using Click package and appreciate any update on this..any roadmap?? |
IMHO the best way to go is making gooey supports https://github.com/wooey/clinto spec to build interfaces, and build extra parsers on that project. related to wooey/clinto#12 |
@mgaitan do wooey and gooey use the same input from clinto? |
@pombredanne not currently. would be a great idea IMHO |
Note that there is QUICK for |
Closing. No plans to implement at the moment. Community patches are always welcome, though! |
My comment on this other issue may be of help if you want to run a CLI mode without having to pass extra flags, and also with the ability to customize the CLI handler isolated from Gooey. My use case was to define a GUI function using Gooey and a CLI function using Click; both were defined in separate functions. I know it's not the most convenient way of handling this, but it's the only way of customizing the CLI mode isolated from the GUI mode. |
How hard would it be to have Gooey work with Click https://github.com/mitsuhiko/click a popular CLI framework by @mitsuhiko maker of Flask among other super goodies?
Note that Click uses neither
argparse
noroptparse
but should provide introspection capabilities.The text was updated successfully, but these errors were encountered: