Introducing Python Fire, a library for automatically generating command line interfaces
By David Bieber, Software Engineer on Google Brain
March 7, 2017
Today we are pleased to announce the open-sourcing of Python Fire. Python Fire generates command line interfaces (CLIs) from any Python code. Simply call the Fire function in any Python program to automatically turn that program into a CLI. The library is available from pypi via `pip install fire`, and the source is available on GitHub.
Python Fire will automatically turn
your code into a CLI without you needing to do any additional work. You
don't have to define arguments, set up help information, or write a main
function that defines how your code is run. Instead, you simply call the
`Fire` function from your main module, and Python Fire takes care of the
rest. It uses inspection to turn whatever Python object you give it --
whether it's a class, an object, a dictionary, a function, or even a
whole module -- into a command line interface, complete with tab
completion and documentation, and the CLI will stay up-to-date even as
the code changes.
Between Python Fire's simplicity, generality, and power, we hope you find it a useful library for your own projects.