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

  • Simple CLI generation
  • Debugging help
  • Exploring code
  • Interactive REPL


pip install fire

Fire is tested against Python 2.7, 3.4, 3.5, 3.6.

import fire

class Calculator(object):
    """A simple calculator."""

    def double(self, number):
        return 2 * number

if __name__ == '__main__':


python double 10  # 20
python double --number=15  # 30
Creating a CLI Command Notes
import import fire -
Call fire.Fire() Turns the current module into a Fire CLI.
Call fire.Fire(component) Turns component into a Fire CLI.
Using a CLI Command Notes
Help command -- --help -
REPL command -- --interactive Interactive mode.
Separator command -- --separator=X sets the separator
Using a CLI Command Notes
Completion command -- --completion Completion script
Trace command -- --trace Trace the command.
Verbose command -- --verbose -

Note that flags are separated from the Fire command by an isolated -- arg.

See example .py files in the same dir as this notebook.