Heating things up

Python Fire v0.2.0 CLI library upgrades with new improvements

Sarah Schlothauer
© Shutterstock / Jon Naustdalslid

Python Fire turns up with a new update. The latest release, version v0.2.0 adds some new improvements. This library auto-generates command line interfaces (CLI) from any Python object. You can call Fire on Python functions, classes, objects, dicts, or anything else!

Python Fire heats things up with one spicy command: Fire. This open source library automatically generates command line interfaces from any Python object. It can be used as a tool for developing and debugging by calling Fire in the library.

The latest release arrived on July 26, 2019. Version 0.2.0 improves a few things and makes some tweaks to the library. Let’s fan the flames and see what’s included in the update, as well as some uses and benefits.

Updates and improvements

Version 0.2.0 released with a few new improvements in tow. Take a look at the latest changes:

SEE ALSO: LazyDocker – simple terminal UI aims to make Docker easier

  • Help screens: New cleaner help screen appearances. Help screens appear after encountering a user error.
  • Custom serialization: Define a custom __str__ method on an object and it will be used to serialize the object in the final result of a Fire command.
  • Docstring parsing: Partial support for three common docstrings: Google, numpy, and REST style.
  • Accessing –help: No need to separate –help with an extra –.
  • NamedTuples support: Fields of namedtuples objects accessible
  • Callable objects: Use flag syntax in order to call a callable object
  • Single-hyphen flag support: Use either  -flag and  --flag
  • Short-flags now permitted
  • Fish completion support

Benefits of Fire

Some of Python Fire’s benefits and uses:

SEE ALSO: The Second Age of Agile: measuring success with meaningful Agile metrics

  • Call Fire on functions, classes, objects, dicts, or anything else.
  • Debugging code: Call Fire in the library and run functionality directly from the command line. No need to load imports.
  • Easy Bash transitions: Call Python directly from Bash. Mix and match functions together with familiar Unix tools.
  • Fire upon existing modules: Take code from elsewhere and call Fire on it. From GitHub: “Call Fire on the difflib library and you get a powerful diffing tool. Call Fire on the Python Imaging Library (PIL) module and you get a powerful image manipulation command line tool, very similar in nature to ImageMagick.”
  • Easier Python REPL: Save time by using the --interactive flag and start with already defined variables and modules.

Read more about its uses on GitHub.

Ready, aim…

Install Python Fire from pypi using pip install fire. Or clone and run the source with python install.

To get started, the documentation suggests that the easiest way is by calling  fire.Fire() at the end of the program. Check out the full guide and some examples here.

If Fire doesn’t light up your world, take a look at a few other similar command-line applications.

  • Click: Python package that creates CLI with little code.
  • Clize : Python argument parser, an alternative to argparse
Sarah Schlothauer

Sarah Schlothauer

All Posts by Sarah Schlothauer

Sarah Schlothauer is the editor for She received her Bachelor's degree from Monmouth University, West Long Branch, New Jersey. She currently lives in Frankfurt, Germany with her husband and cat where she enjoys reading, writing, and medieval reenactment. She is also the editor for Conditio Humana, an online magazine about ethics, AI, and technology.

Inline Feedbacks
View all comments