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 fireVerified import paths — ran on the pinned version, not inferred.
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`.
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'`).
Ensure you are using `fire` version `0.1.3` or newer. This issue was resolved in that release.
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.
Ensure you are using the correct Python environment and install the library using pip: `pip install fire`
Rename your Python script file to something other than 'fire.py' (e.g., 'my_cli.py') to avoid the module name conflict.
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`).
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`.
No dependency data recorded yet.