Registry / devops / fire
library0.7.1pypypi✓ verified 26d ago

Python Fire is a library for automatically generating command-line interfaces (CLIs) from any Python object. It enables developers to turn functions, classes, objects, and dictionaries into CLIs with minimal code, simplifying the creation of powerful command-line tools. The current version is 0.7.1, with a consistent release cadence focusing on compatibility, feature enhancements, and bug fixes.

pip install fire
INSTALL
IMPORT
SIG · FIRE
F
fire
devopspythonv0.7.1
Install
1.7s avg
Import
248ms
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.7.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.262s · 18.7MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.7s · import 0.234s · 19MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Fire
from fire import Fire
Fire is the primary entry point for generating CLIs.

Define a Python function or class, then pass it to `fire.Fire()` within your script. When executed, Fire automatically creates a CLI from the object. You can run this example as `python your_script.py --name David --enthusiasm 3` or `python your_script.py --help`.

import fire def greet(name='World', enthusiasm=1): """Greets the given name with specified enthusiasm.""" return f"Hello {name}{'!' * enthusiasm}" if __name__ == '__main__': fire.Fire(greet)
fire --version
Debug
Known issues
breakingPython Fire dropped support for Python 2 starting with version 0.7.0. If your project relies on Python 2, you must use an older version of the library.
fix
Upgrade your project to Python 3, or pin `fire` to a version less than 0.7.0 (e.g., `pip install 'fire<0.7.0'`).
affects: >=0.7.0
gotchaArguments passed to a Fire-generated CLI that start with `--` (e.g., `--my-flag`) might not have been correctly interpreted as strings in very old versions of Fire. This could lead to unexpected parsing errors.
fix
Ensure you are using `fire` version `0.1.3` or newer. This issue was resolved in that release.
affects: <0.1.3
gotchaWhile `fire.Fire()` is typically called directly within a script, you can also use `python -m fire <module_name>` or `python -m fire <path_to_file.py>` to generate a CLI for an existing module or file without modifying its source code. This is useful for exploring or interacting with third-party libraries.
fix
For an executable script, include `if __name__ == '__main__': fire.Fire(your_object)`. To interact with an arbitrary module, use the command line form: `python -m fire os.path` to expose the `os.path` module as a CLI.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'fire'
The 'fire' library has not been installed in your Python environment or the wrong Python interpreter is being used.
fix
Ensure you are using the correct Python environment and install the library using pip: `pip install fire`
AttributeError: module 'fire' has no attribute 'Fire'
This error typically occurs when your Python script file is named 'fire.py', which causes a naming conflict with the installed `fire` package. When you try to `import fire`, Python imports your local script instead of the library.
fix
Rename your Python script file to something other than 'fire.py' (e.g., 'my_cli.py') to avoid the module name conflict.
ERROR: Could not consume arg: <argument_name>
Python Fire did not correctly parse the command-line arguments, often due to arguments containing spaces not being properly quoted, or an unexpected argument structure.
fix
Ensure arguments with spaces are enclosed in quotes (e.g., `python my_script.py say_hello 'John Doe'`). For flags and values, use the `--` separator to distinguish Fire's internal flags from your command's arguments, or explicitly use flag syntax (e.g., `python my_script.py my_function --arg_name=value`).
TypeError: <function_name>() missing 1 required positional argument: '<argument_name>'
A required argument for a function exposed via Python Fire was not provided in the command-line call.
fix
Provide all necessary arguments to the function when calling it from the command line. For example, if a function `greet(name)` is fired, call it as `python your_script.py greet --name='World'` or `python your_script.py greet World`.
Upgrade
Version history
0.7.1latest on PyPI · released Aug 16, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
22 hits · last 30 days
node
20
Resources
fire — pip install fire · libregistry