Metadata-Version: 2.4
Name: nornir-rich
Version: 0.3.0
Summary: Collection of 'nice looking' functions with rich for nornir
Author-email: ubaumann <github@m.ubaumann.ch>
License: Apache-2.0
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: nornir>=3
Requires-Dist: rich>=12

# nornir_rich

## Install

```bash
pip install nornir-rich
```

## Usage

Features

- Print functions
  - `print_result`
  - `print_failed_hosts`
  - `print_inventory`
- Processors
  - `progressbar`


### Print example

```python
from nornir_rich.functions import print_result

results = nr.run(
    task=hello_world
)

print_result(results)
print_result(results, vars=["diff", "result", "name", "exception", "severity_level"])
```

### Progress bar example

```python
from time import sleep
from nornir_rich.progress_bar import RichProgressBar


def random_sleep(task: Task) -> Result:
    delay = randrange(10)
    sleep(delay)
    return Result(host=task.host, result=f"{delay} seconds delay")


nr_with_processors = nr.with_processors([RichProgressBar()])
result = nr_with_processors.run(task=random_sleep)
```


## Images

### Print Inventory

![Print inventory](https://raw.githubusercontent.com/InfrastructureAsCode-ch/nornir_rich/main/docs/imgs/print_inventory.png)

### Print Result

![Print Result](https://raw.githubusercontent.com/InfrastructureAsCode-ch/nornir_rich/main/docs/imgs/print_result.png)

### Progress Bar

![Progress Bar](https://raw.githubusercontent.com/InfrastructureAsCode-ch/nornir_rich/main/docs/imgs/progressbar.png)


More [examples](https://raw.githubusercontent.com/InfrastructureAsCode-ch/nornir_rich/main/docs/imgs/print_functions.ipynb)
