Date: 29 May 2023

Module : fire


Installation : pip install fire


About:

Python Fire is a library for automatically generating command line
interfaces (CLIs) with a single line of code.

It will turn any Python module, class, object, function, etc.  into a CLI.
It’s called Fire because when you call Fire(), it fires off your command.


Sample:

import fire


def add(x, y):

  return x + y


def multiply(x, y):

  return x * y


if __name__ == '__main__':

  fire.Fire()


Output:

$ python example.py add 10 20

30

$ python example.py multiply 10 20

200


Reference:

https://pypi.org/project/fire/
_______________________________________________
Chennaipy mailing list
Chennaipy@python.org
https://mail.python.org/mailman/listinfo/chennaipy

Reply via email to