Google ignites Python library for command lines

The Python Fire library, which Google has already used in its machine intelligence project, automatically converts code into a CLI

With its Python Fire library, Google is offering Python developers a mechanism to easily generate command line interfaces.

Just made available via open source, Python Fire turns code into a CLI without developers needing to do any more work, making it easier to transition between the Bash Linux CLI and Python. Google engineers have already used Python Fire to produce CLI tools from Python libraries, including the Python Imaging Library and an tool used in the Google Brain machine intelligence project that manages experiments equally from Python or Bash.

"You don't have to define arguments, set up help information, or write a main function that defines how your code is run," said Dave Bieber, a software engineer for Google Brain

Fire uses inspection to turn Python objects into a CLI that offers tab completion and documentation. Fire can be run on any object including functions, classes and modules. The tool can help debugging or exploring Python code and turning existing code into a CLI, and developers also will find it easier to use a REPL via Fire. CLIs built with Fire come with an interactive mode. "Run the CLI with the `--interactive` flag to launch an iPython REPL with the result of your command," Bieber said.

Join the newsletter!

Or

Sign up to gain exclusive access to email subscriptions, event invitations, competitions, giveaways, and much more.

Membership is free, and your security and privacy remain protected. View our privacy policy before signing up.

Error: Please check your email address.

Tags python

More about GoogleLinux

Show Comments
[]