# Python Fire Module

Python Fire is a library for automatically generating command line interfaces (CLIs) from absolutely any Python object.

## Installation

```bash
pip install fire
```

## Basic Usage

### Exposing a Function

You can turn a simple function into a CLI.

```python
import fire

def hello(name="World"):
  return "Hello %s!" % name

if __name__ == '__main__':
  fire.Fire(hello)
```

Run it from the command line:
```bash
python script.py --name=David
# Output: Hello David!
```

### Exposing a Class

You can expose a class and its methods.

```python
import fire

class Calculator(object):
  def add(self, x, y):
    return x + y

  def multiply(self, x, y):
    return x * y

if __name__ == '__main__':
  fire.Fire(Calculator)
```

Run it:
```bash
python script.py add 10 20
# Output: 30
```

[[programming/python/python]]