How google/python-fire works
Python Fire turns a Python object into a command-line interface: a caller invokes Fire, arguments and flags are parsed, the selected object members are traversed and called, and results or CLI assistance are presented. The graph includes the documented help, completion, trace, and interactive capabilities. Relationships are limited to README statements and source references in the supplied excerpts and SOURCE INDEX; unsampled implementations are represented only where the tree supports a path.
Main entry points: core.py Dispatch engine · helptext.py Help generation · console_io.py Console output · console_attr.py Console attributes
Components 24
API and dispatch
- Module entry
fire/__main__.py - Fire API
fire/__init__.py
Command execution
- Dispatch engine
fire/core.py - Argument parser
fire/parser.py - Object inspection
fire/inspectutils.py - Value handling
fire/value_types.py - CLI decorators
fire/decorators.py
Help and metadata
- Help generation
fire/helptext.py - Docstring parsing
fire/docstrings.py - Custom descriptions
fire/custom_descriptions.py - Text formatting
fire/formatting.py
CLI assistance
- Execution trace
fire/trace.py - Shell completion
fire/completion.py - Interactive mode
fire/interact.py
Terminal I/O
- Console output
fire/console/console_io.py - Console attributes
fire/console/console_attr.py - OS console attributes
fire/console/console_attr_os.py - Encoding support
fire/console/encoding.py - Internal pager
fire/console/console_pager.py - Platform support
fire/console/platforms.py - Console file helpers
fire/console/files.py - Console text helpers
fire/console/text.py
Other components
- CLI user
- Python component
Connections 35
- CLI user → Module entry: runs CLI
README.md - CLI user → Fire API: calls Fire
README.md - Module entry → Fire API: loads API
fire/__main__.py - Fire API → Dispatch engine: delegates to
fire/__init__.py - Dispatch engine → Argument parser: parses arguments
fire/core.py - Dispatch engine → Python component: traverses and calls
README.md - Dispatch engine → Object inspection: inspects objects
fire/core.py - Dispatch engine → Value handling: handles values
fire/core.py - Dispatch engine → CLI decorators: reads metadata
fire/core.py - Dispatch engine → Execution trace: records execution
fire/core.py - Dispatch engine → Help generation: generates help
fire/core.py - Dispatch engine → Shell completion: generates completion
fire/core.py - Dispatch engine → Interactive mode: starts REPL
fire/core.py - Dispatch engine → Console output: writes output
fire/core.py - Help generation → Docstring parsing: parses descriptions
fire/helptext.py - Help generation → Custom descriptions: uses overrides
fire/helptext.py - Help generation → CLI decorators: reads metadata
fire/helptext.py - Help generation → Object inspection: inspects members
fire/helptext.py - Help generation → Value handling: formats values
fire/helptext.py - Help generation → Text formatting: formats help
fire/helptext.py - Custom descriptions → Text formatting: uses formatting
fire/custom_descriptions.py - Shell completion → Object inspection: filters members
fire/completion.py - Execution trace → Object inspection: locates components
fire/trace.py - Value handling → Object inspection: uses inspection
fire/value_types.py - Console output → Internal pager: pages output
fire/console/console_io.py - Console output → Console attributes: gets encoding
fire/console/console_io.py - Console output → Encoding support: encodes output
fire/console/console_io.py - Console output → Console file helpers: uses file helpers
fire/console/console_io.py - Internal pager → Console attributes: uses terminal attributes
fire/console/console_pager.py - Console attributes → OS console attributes: uses OS attributes
fire/console/console_attr.py - Console attributes → Encoding support: detects encoding
fire/console/console_attr.py - Console attributes → Console text helpers: uses text helpers
fire/console/console_attr.py - OS console attributes → Encoding support: uses encoding
fire/console/console_attr_os.py - Console file helpers → Encoding support: uses encoding
fire/console/files.py - Console file helpers → Platform support: uses platform support
fire/console/files.py