You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Move classes and functions across the modules, extract new modules — in order to reduce the complexity and prepare the codebase for adding even more code.
The behaviour is not changed, only the imports.
Description
Before this PR, some modules were too large, up to 1k of lines, containing too many aspects and topics — as it has historically happened when new features were added. For example, activity execution was part of handling.py, as it was nearly a clone of handler execution. Similarly, event processing and handler invocation were there too (in handling.py) — since the times they were short and simple.
With this PR, some huge modules are split into smaller ones, and classes/functions are moved all around. For example, watch-event handling is now renamed to processing and moved to processing.py — as per event processing of the event-driven design, which it is by its nature — this releases the term handling to the callback functions, which are currently called handlers.
This is needed to make more space for adding more code (e.g. for daemons and timers) without exploding the modules beyond understanding.
See the list of commits for individual changes (they are all atomic). Briefly:
Rename watch-event "handling" routines to "processing" routines.
Extract the in-memory multi-step handling cycle to a reusable routine (used in activities, will be used in daemons/timers).
The latter split also removes the cyclic imports as detected by LGTM (all 16 alarms at once) — this cycle is broken by moving BaseHandler away from registries:
→ registries
→ invocation (for get_kwargs(), needed for matching callbacks)
→ lifecycles (for LifeCycleFn, needed for Invokable definition)
→ registries (for BaseHandler, needed for handlers kwarg)
Replaced with a regular dependency tree:
→ registries
→ invocation (for get_kwargs(), needed for matching callbacks)
→ lifecycles (for LifeCycleFn, needed for Invokable definition)
→ handlers (for BaseHandler, needed for handlers kwarg)
→ handlers (for all handlers dataclasses, previously located in registries)
The users should not be affected, as these are the internal changes only — unless they monkey-patch some of the Kopf's internals.
What do these changes do?
Move classes and functions across the modules, extract new modules — in order to reduce the complexity and prepare the codebase for adding even more code.
The behaviour is not changed, only the imports.
Description
Before this PR, some modules were too large, up to 1k of lines, containing too many aspects and topics — as it has historically happened when new features were added. For example, activity execution was part of
handling.py
, as it was nearly a clone of handler execution. Similarly, event processing and handler invocation were there too (inhandling.py
) — since the times they were short and simple.With this PR, some huge modules are split into smaller ones, and classes/functions are moved all around. For example, watch-event handling is now renamed to processing and moved to
processing.py
— as per event processing of the event-driven design, which it is by its nature — this releases the term handling to the callback functions, which are currently called handlers.This is needed to make more space for adding more code (e.g. for daemons and timers) without exploding the modules beyond understanding.
See the list of commits for individual changes (they are all atomic). Briefly:
handling.py
->handling.py
+processing.py
+activities.py
registries.py
->registries.py
+handlers.py
+callbacks.py
+errors.py
The latter split also removes the cyclic imports as detected by LGTM (all 16 alarms at once) — this cycle is broken by moving
BaseHandler
away fromregistries
:registries
invocation
(forget_kwargs()
, needed for matching callbacks)lifecycles
(forLifeCycleFn
, needed forInvokable
definition)registries
(forBaseHandler
, needed forhandlers
kwarg)Replaced with a regular dependency tree:
registries
invocation
(forget_kwargs()
, needed for matching callbacks)lifecycles
(forLifeCycleFn
, needed forInvokable
definition)handlers
(forBaseHandler
, needed forhandlers
kwarg)handlers
(for all handlers dataclasses, previously located inregistries
)The users should not be affected, as these are the internal changes only — unless they monkey-patch some of the Kopf's internals.
Issues/PRs
Type of changes
Checklist
CONTRIBUTORS.txt
The text was updated successfully, but these errors were encountered: