API Reference

Python Fire

A library that turns any Python component into a command-line interface automatically.

Official Documentation ↗
CompatibilityThis documentation covers version v0.7. Check the official docs for the latest API surface.

Installation

pippip install fire

Methods

Fire inspects a component and generates a CLI from its functions, methods, and arguments.

Key Features

  • Zero-boilerplate CLI generation
  • Works with functions, classes, and dicts
  • Shell completion and REPL mode

Usage Notes

Pin a version and check the official docs for the API surface you depend on before upgrading.

Errors

The following points are quoted verbatim from the official documentation. 来源:https://google.github.io/python-fire/ · 取证方式:HTTP GET 官方 README/文档页(HTML 去标签) · 抓取时间:2026-11-07T13:49:41.453Z. Any error type, throw condition or recovery step not stated there is left unspecified; this page does not infer exception classes or return values.

FAQ

How are arguments parsed?
Parameter names, defaults, and type annotations drive the generated flags and positional arguments.
How do I test the CLI?
Import the underlying function and call it directly; Fire is a thin layer, so unit tests do not need the parser.
How do I see help?
Run the CLI with --help to list commands, and pass --help to a subcommand for its arguments.