What does HackerNews think of python-fire?

Python Fire is a library for automatically generating command line interfaces (CLIs) from absolutely any Python object.

Language: Python

#19 in Python
My fav python cli tool is Fire. No need to even decorate your functions. There may be some limitations compared to Piou, I will have to explore that to find out.

https://github.com/google/python-fire

Python-fire is a great package for this. Will look into bargeparse

https://github.com/google/python-fire

I love that! Argparse is such an old and boring solution to such a simple problem that we need more like this. And I have hope that one of the solutions will make it into the standard library at some point.

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/

Gooey is a brilliant bit of software.

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.

[0] https://github.com/google/python-fire

I was using click, but it requires too much boilerplate. Fire is much simpler to use, just as powerful (or maybe 95% as powerful) and it's developed by Google devs (it's not an official Google project as far as I remember), so it seems of reasonable quality.

https://github.com/google/python-fire

Having not used typer, your description is reminiscent of fire [1], which has worked well for our purposes.

[1]: https://github.com/google/python-fire

As another commenter here mentioned, you might want to consider fire [1], depending on the complexity of your argparse-usage it might check 90% of your boxes for you.

[1]: https://github.com/google/python-fire

You might want to look at Google’s python fire which makes this sort of thing obsolete.

https://github.com/google/python-fire

Just comment your code and get pretty arguments.

Yep, totally agree. Python's metaprogramming is powerful enough that you can twist it into any shape you like! :)

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

I personally enjoy using https://github.com/google/python-fire nowadays.

-- 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.

Someone above posted this: https://github.com/google/python-fire

seems you could generate something with fire tool and then parse it dynamically with Gooey.

I'm not a big fan of GUI in general but, ooo, this is nice.

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.

https://github.com/google/python-fire

I've used Fire[0] for a few projects and have been meaning to give Click a try, but I'm not sure I like the syntax after reading through the article (holy moly decorators). Seems unwieldy to me, but does anyone have experience with both?

[0] https://github.com/google/python-fire

I have nothing to directly comment on the tutorial. Just a tangential mention regarding the tedious argument parsing boilerplate in Python, I have found Python Fire to be much more convenient: https://github.com/google/python-fire

It would have shaved off another 15-20 lines from the 503 line example ;-)

Click is nice, but for my money, Fire is what Click should have been. https://github.com/google/python-fire