Skip to content

Commit

Permalink
feat: add the sghi.dispatch module
Browse files Browse the repository at this point in the history
Add the `sghi.dispatch` module which contains a Multiple-producer-multiple-accept signal-dispatcher implementation heavily inspired by [PyDispatcher](https://grass.osgeo.org/grass83/manuals/libpython/pydispatch.html) and [Django dispatch](https://docs.djangoproject.com/en/dev/topics/signals/).
  • Loading branch information
kennedykori committed Oct 9, 2023
1 parent 71d87d3 commit 010b948
Show file tree
Hide file tree
Showing 6 changed files with 944 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,15 @@
("py:class", "TracebackType"), # Used as type annotation. Only available when type checking
("py:class", "concurrent.futures._base.Executor"), # sphinx can't find it
("py:class", "concurrent.futures._base.Future"), # sphinx can't find it
("py:class", "sghi.dispatch._ST_contra"), # private type annotations
("py:class", "sghi.task._IT"), # private type annotations
("py:class", "sghi.task._OT"), # private type annotations
("py:class", "sghi.utils.checkers._Comparable"), # private type annotations
("py:class", "sghi.utils.checkers._ST"), # private type annotations
("py:class", "sghi.utils.checkers._T"), # private type annotations
("py:class", "sghi.utils.module_loading._T"), # private type annotations
("py:class", "sghi.typing._CT_contra"), # private type annotations
("py:obj", "sghi.dispatch._ST_contra"), # private type annotations
("py:obj", "sghi.disposable.decorators.not_disposed._P"), # private type annotations
("py:obj", "sghi.disposable.decorators.not_disposed._R"), # private type annotations
("py:obj", "sghi.task._IT"), # private type annotations
Expand Down
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ API Reference

sghi.app
sghi.config
sghi.dispatch
sghi.disposable
sghi.exceptions
sghi.task
Expand Down
13 changes: 13 additions & 0 deletions src/sghi/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,25 @@
from typing import Any, Final

from .config import Config, SettingInitializer
from .dispatch import Dispatcher

# =============================================================================
# GLOBAL APPLICATION/TOOL CONSTANTS
# =============================================================================


dispatcher: Final[Dispatcher] = Dispatcher.of_proxy()
"""The main application :class:`dispatcher<sghi.dispatch.Dispatcher>`.
.. admonition:: Note: To application authors
:class: note
This value is set to an instance of :class:`sghi.dispatch.DispatcherProxy`-
enabling the default wrapped instance to be replaced with a more
appropriate value during application setup.
"""

conf: Final[Config] = Config.of_proxy()
"""The application configurations.
Expand Down
Loading

0 comments on commit 010b948

Please sign in to comment.