diff --git a/README.md b/README.md index ccba9bf..687ca25 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,8 @@ simple event-based model over core Python utilities like `ThreadPoolExecutor` to facilitate reactivity and manage concurrent responses. +![High-level execution flow diagram](docs/_static/execlib.png) + There are a few top-level classes exposed by the package: - **Router**: Central event routing object. Routers facilitate route registration, @@ -17,3 +19,20 @@ There are a few top-level classes exposed by the package: iNotify to dynamically respond to file events. - **Server**: Long-running process manager for listeners and optional live-reloading via HTTP. Interfaces with listener `start()` and `shutdown()` for graceful interruption. + +# Install +```sh +pip install execlib +``` + +# Development + +## Documentation +```sh +pip install execlib[docs] +``` + +## Testing +```sh +pip install execlib[tests] +``` diff --git a/docs/_static/execlib.png b/docs/_static/execlib.png new file mode 100644 index 0000000..6f51e9e Binary files /dev/null and b/docs/_static/execlib.png differ diff --git a/execlib/router.py b/execlib/router.py index de3eecf..9bdcd3d 100644 --- a/execlib/router.py +++ b/execlib/router.py @@ -860,14 +860,15 @@ class Router[E: Event]: # manually track and cancel pending futures b/c `.shutdown(cancel_futures=True)` # is misleading, and will cause an outer `as_completed` loop to hang - for future in tqdm( - list(self._active_futures), - desc=color_text( - f'Cancelling {len(self._active_futures)} pending futures...', - Fore.BLACK, Back.RED), - colour='red', - ): - future.cancel() + if self._active_futures: + for future in tqdm( + list(self._active_futures), + desc=color_text( + f'Cancelling {len(self._active_futures)} pending futures...', + Fore.BLACK, Back.RED), + colour='red', + ): + future.cancel() if self._thread_pool_2 is not None: # cancel pending futures (i.e., those not started) diff --git a/pyproject.toml b/pyproject.toml index 2c5eff6..8eaa0ac 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,6 +43,7 @@ docs = [ "furo", "myst-parser", ] +jupyter = ["ipykernel"] [project.urls] Homepage = "https://doc.olog.io/execlib"