What does HackerNews think of python-fire?
Python Fire is a library for automatically generating command line interfaces (CLIs) from absolutely any Python object.
https://github.com/google/python-fire
Gooey can do (CLI -> GUI):
There are some others like yours:
Google's python-fire (1)
Docopt (2), which creates the cli from the documentation instead of the other way around
Click (3)
And my own commandeer (4)
Typer (5)
(1) https://github.com/google/python-fire (2) http://docopt.org/ (3) https://click.palletsprojects.com/en/8.0.x/ (4) https://pythonhosted.org/Commandeer/index.html (5) https://typer.tiangolo.com/
We use it in combination with Python Fire [0] to easily convert python code to something that users can interact with. Python fire converts our python code into a CLI without all the manual parameter parsing, and Gooey turns the CLI into a simple GUI.
https://github.com/google/python-fire
Just comment your code and get pretty arguments.
My favorite gem, especially before python3 and typehinting were more widely in-use, is attrs [0]. It allows you to define rich data types (which python is great for) in a declarative/expressive/legible manner (which python sometimes isn't great for).
imo, it's a fantastic example of how metaprogramming allows libraries to actually enhance a language. Another one that demonstrates the power of MP is fire[1], a tool that allows you to drive classes with a MP-generated CLI.
[0] https://www.attrs.org/en/stable/examples.html [1] https://github.com/google/python-fire
-- it's probably not the most flexible tool, but IMHO it's the one with the best API: fire.Fire(obj) and everything else is taken care of ;)
p.s.: for lazy imports, just don't put them in the top of your module in the entry point.
seems you could generate something with fire tool and then parse it dynamically with Gooey.
Combine with python-fire for great fun, eh?
> Python Fire is a library for automatically generating command line interfaces (CLIs) from absolutely any Python object.
It would have shaved off another 15-20 lines from the 503 line example ;-)
- https://github.com/home-assistant/home-assistant
- https://github.com/channelcat/sanic
- https://github.com/pypa/pipenv