Metadata-Version: 2.1
Name: minireload
Version: 0.0.6
Summary: Small library for live code reloading
Author-email: Jona Ruof <jona.ruof@uni-ulm.de>
Project-URL: Homepage, https://github.com/joruof/minireload
Project-URL: Bug Tracker, https://github.com/joruof/minireload/issues
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: watchdog>=4.0.0

# minireload

Small library for live code reloading of python scripts.
Basically just a nicer front-end for superreload + exception handling.
Requires only the watchdog library to check for filesystem changes.


## Setup

Available via pip:
```
pip3 install minireload
```

## Usage

As demonstrated by the code in ```example/```.

main.py
```python

from impl import main


if __name__ == "__main__":
    # Since the __main__ file cannot be reloaded by the python interpreter,
    # it just refers to another module, which contains the actual code.
    main()
```

impl.py
```python
import time

import minireload as mr


def update():

    print("Try changing me!")
    time.sleep(0.1)

    return 42


def main():

    enable_autoreload = True

    if enable_autoreload:
        func = mr.WrappingReloader(update)
    else:
        func = update

    while True:
        res = func()

        if type(res) == mr.ReloadErrorInfo:
            print("Everything is awful:", res)
        else:
            print("Everything is awesome:", res)
```

The update function is wrapped in a ```WrappingReloader```. By default this
reloads the toplevel module the function belongs to and handles exceptions,
which may happen during live code editing.
