Logo

0x3d.Site

is designed for aggregating information.
Welcome
check repository here

Python Fire PyPI

Python Fire is a library for automatically generating command line interfaces (CLIs) from absolutely any Python object.

  • Python Fire is a simple way to create a CLI in Python. [1]
  • Python Fire is a helpful tool for developing and debugging Python code. [2]
  • Python Fire helps with exploring existing code or turning other people's code into a CLI. [3]
  • Python Fire makes transitioning between Bash and Python easier. [4]
  • Python Fire makes using a Python REPL easier by setting up the REPL with the modules and variables you'll need already imported and created. [5]

Installation

To install Python Fire with pip, run: pip install fire

To install Python Fire with conda, run: conda install fire -c conda-forge

To install Python Fire from source, first clone the repository and then run: python setup.py install

Basic Usage

You can call Fire on any Python object:
functions, classes, modules, objects, dictionaries, lists, tuples, etc. They all work!

Here's an example of calling Fire on a function.

import fire

def hello(name="World"):
  return "Hello %s!" % name

if __name__ == '__main__':
  fire.Fire(hello)

Then, from the command line, you can run:

python hello.py  # Hello World!
python hello.py --name=David  # Hello David!
python hello.py --help  # Shows usage information.

Here's an example of calling Fire on a class.

import fire

class Calculator(object):
  """A simple calculator class."""

  def double(self, number):
    return 2 * number

if __name__ == '__main__':
  fire.Fire(Calculator)

Then, from the command line, you can run:

python calculator.py double 10  # 20
python calculator.py double --number=15  # 30

To learn how Fire behaves on functions, objects, dicts, lists, etc, and to learn about Fire's other features, see the Using a Fire CLI page.

For additional examples, see The Python Fire Guide.

Why is it called Fire?

When you call Fire, it fires off (executes) your command.

Where can I learn more?

Please see The Python Fire Guide.

Reference

SetupCommandNotes
installpip install fire
Creating a CLICommandNotes
importimport fire
Callfire.Fire()Turns the current module into a Fire CLI.
Callfire.Fire(component)Turns component into a Fire CLI.
Using a CLICommandNotes
Helpcommand --help or command -- --help
REPLcommand -- --interactiveEnters interactive mode.
Separatorcommand -- --separator=XSets the separator to X. The default separator is -.
Completioncommand -- --completion [shell]Generates a completion script for the CLI.
Tracecommand -- --traceGets a Fire trace for the command.
Verbosecommand -- --verbose

Note that these flags are separated from the Fire command by an isolated --.

License

Licensed under the Apache 2.0 License.

Disclaimer

This is not an official Google product.

Python
Python
Python is a versatile, high-level programming language known for its simplicity and readability. It’s widely used in web development, data analysis, AI, and scientific computing, supported by a rich ecosystem of libraries.
dataclasses — Data Classes
dataclasses — Data Classes
curses — Terminal handling for character-cell displays
curses — Terminal handling for character-cell displays
cssutils
cssutils
selenium
selenium
GitHub - gevent/gevent: Coroutine-based concurrency library for Python
GitHub - gevent/gevent: Coroutine-based concurrency library for Python
GitHub - django/daphne: Django Channels HTTP/WebSocket server
GitHub - django/daphne: Django Channels HTTP/WebSocket server
GitHub - openstack/cliff: Command Line Interface Formulation Framework. Mirror of code maintained at opendev.org.
GitHub - openstack/cliff: Command Line Interface Formulation Framework. Mirror of code maintained at opendev.org.
GitHub - sloria/doitlive: Because sometimes you need to do it live
GitHub - sloria/doitlive: Because sometimes you need to do it live
GitHub - cdgriffith/Box: Python dictionaries with advanced dot notation access
GitHub - cdgriffith/Box: Python dictionaries with advanced dot notation access
GitHub - tartley/colorama: Simple cross-platform colored terminal text in Python
GitHub - tartley/colorama: Simple cross-platform colored terminal text in Python
asyncio — Asynchronous I/O
asyncio — Asynchronous I/O
difflib — Helpers for computing deltas
difflib — Helpers for computing deltas
Open Source Cloud Computing Infrastructure - OpenStack
Open Source Cloud Computing Infrastructure - OpenStack
multiprocessing — Process-based parallelism
multiprocessing — Process-based parallelism
GitHub - pgjones/hypercorn: Hypercorn is an ASGI and WSGI Server based on Hyper libraries and inspired by Gunicorn.
GitHub - pgjones/hypercorn: Hypercorn is an ASGI and WSGI Server based on Hyper libraries and inspired by Gunicorn.
GitHub - django-cache-machine/django-cache-machine: Automatic caching and invalidation for Django models through the ORM.
GitHub - django-cache-machine/django-cache-machine: Automatic caching and invalidation for Django models through the ORM.
GitHub - sehmaschine/django-grappelli: A jazzy skin for the Django Admin-Interface (official repository).
GitHub - sehmaschine/django-grappelli: A jazzy skin for the Django Admin-Interface (official repository).
GitHub - sirfz/tesserocr: A Python wrapper for the tesseract-ocr API
GitHub - sirfz/tesserocr: A Python wrapper for the tesseract-ocr API
GitHub - copier-org/copier: Library and command-line utility for rendering projects templates.
GitHub - copier-org/copier: Library and command-line utility for rendering projects templates.
GitHub - scrapy/scrapy: Scrapy, a fast high-level web crawling & scraping framework for Python.
GitHub - scrapy/scrapy: Scrapy, a fast high-level web crawling & scraping framework for Python.
Python - Visual Studio Marketplace
Python - Visual Studio Marketplace
coverage
coverage
GitHub - pennersr/django-allauth: Integrated set of Django applications addressing authentication, registration, account management as well as 3rd party (social) account authentication.
GitHub - pennersr/django-allauth: Integrated set of Django applications addressing authentication, registration, account management as well as 3rd party (social) account authentication.
doublex
doublex
configparser — Configuration file parser
configparser — Configuration file parser
GitHub - bbangert/beaker: WSGI middleware for sessions and caching
GitHub - bbangert/beaker: WSGI middleware for sessions and caching
GitHub - mitsuhiko/pluginbase: A simple but flexible plugin system for Python.
GitHub - mitsuhiko/pluginbase: A simple but flexible plugin system for Python.
GitHub - nicfit/eyeD3: eyeD3 is a Python module and command line program for processing ID3 tags. Information about mp3 files (i.e bit rate, sample frequency, play time, etc.) is also provided. The formats supported are ID3v1 (1.0/1.1) and ID3v2 (2.3/2.4).
GitHub - nicfit/eyeD3: eyeD3 is a Python module and command line program for processing ID3 tags. Information about mp3 files (i.e bit rate, sample frequency, play time, etc.) is also provided. The formats supported are ID3v1 (1.0/1.1) and ID3v2 (2.3/2.4).
GitHub - sqlalchemy/dogpile.cache: dogpile.cache is a Python caching API which provides a generic interface to caching backends of any variety
GitHub - sqlalchemy/dogpile.cache: dogpile.cache is a Python caching API which provides a generic interface to caching backends of any variety
Panda3D | Open Source Framework for 3D Rendering & Games
Panda3D | Open Source Framework for 3D Rendering & Games
Python
More on Python

Programming Tips & Tricks

Code smarter, not harder—insider tips and tricks for developers.

Error Solutions

Turn frustration into progress—fix errors faster than ever.

Shortcuts

The art of speed—shortcuts to supercharge your workflow.
  1. Collections 😎
  2. Frequently Asked Question's 🤯

Tools

available to use.

Made with ❤️

to provide resources in various ares.