Python Fire is a library for automatically generating command line interfaces (CLIs) from absolutely any Python object.
Repo google/python-fire, read from GitHub 8 h ago. google has not joined Take My Repo.
Full Changelog: v0.7.0...v0.7.1
setup.py by @Borda in #555Full Changelog: v0.6.0...v0.7.0
This is the last release supporting Python 2. Subsequent releases will be Python 3 only. The automatically generated release notes follow.
Github -> GitHub by @jbampton in #425$ sign in bash completion by @maximehk in #472Full Changelog: v0.5.0...v0.6.0
fire.Fire(serialize=custom_serialize_fn) #345You can now pass a custom serialization function to fire to control how the output is serialized.
Your serialize function should accept an object as input, and may return a string as output. If it returns a string, Fire will display that string. If it returns None, Fire will display nothing. If it returns something else, Fire will use the default serialization method to convert it to text.
The default serialization remains unchanged from previous versions. Primitives and collections of primitives are serialized one item per line. Objects that define a custom __str__ function are serialized using that. Complex objects that don't define __str__ trigger their help screen rather than being serialized and displayed.
python -m firepython -m fireYou can use Python Fire without ever modifying your code. To use it, first install Python Fire with pip install fire. Then simply run python -m fire path/to/yourfile.py or python -m fire path.to.yourmodule.
This is both a fast way to use Python Fire to create a CLI from your code, and a way to apply Python Fire quickly to a codebase you don't have access to.