Add CallableService and ServiceLike abstraction#102
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a lightweight abstraction for treating async callables as Service instances, along with a default Service.name derived from the class name. Updates existing service-manager unit tests to avoid clashing with the new Service.name attribute and introduces new unit tests for CallableService and adapters.
Changes:
- Add
Service.namebase property derived from the class name. - Introduce
CallableService,ServiceLike, andas_callable_serviceadapter. - Update unit tests and add new tests covering the new abstractions.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/logicblocks/event/processing/services/types.py |
Adds default Service.name implementation. |
src/logicblocks/event/processing/services/callable.py |
Introduces ServiceLike, CallableService, and as_callable_service. |
src/logicblocks/event/processing/services/__init__.py |
Re-exports new callable-service utilities from services. |
src/logicblocks/event/processing/__init__.py |
Re-exports CallableService from the top-level processing package. |
tests/unit/logicblocks/event/processing/services/test_manager.py |
Renames test service attributes to avoid conflicting with Service.name. |
tests/unit/logicblocks/event/processing/services/test_callable.py |
Adds unit tests for Service.name, CallableService, and as_callable_service. |
changelog.d/20260427_105913_corin_cc_callable_service.md |
Documents the newly added abstractions and Service.name. |
Comments suppressed due to low confidence (1)
src/logicblocks/event/processing/init.py:62
- Top-level
logicblocks.event.processingre-exportsCallableServicebut not the other newly added public helpers (ServiceLike,as_callable_service) that are exported fromlogicblocks.event.processing.servicesand mentioned in the changelog. If these are intended to be part of the main processing API, add them to the imports and__all__here for consistency with the other service-related exports.
from .services import (
CallableService,
ContinueErrorHandler,
ContinueErrorHandlerDecision,
ErrorHandler,
ErrorHandlerDecision,
ErrorHandlingService,
ErrorHandlingServiceMixin,
ExecutionMode,
ExitErrorHandler,
ExitErrorHandlerDecision,
IsolationMode,
PollingService,
RaiseErrorHandler,
RaiseErrorHandlerDecision,
RetryErrorHandler,
RetryErrorHandlerDecision,
Service,
ServiceManager,
TypeMappingErrorHandler,
continue_execution_type_mapping,
error_handler_type_mappings,
exit_fatally_type_mapping,
raise_exception_type_mapping,
retry_execution_type_mapping,
)
76b1520 to
1cad7a3
Compare
1cad7a3 to
8640453
Compare
3506d72 to
15d0284
Compare
CorinChappy
commented
Apr 29, 2026
|
|
||
| if value_is_string and klass_is_class and issubclass(klass, str): | ||
| return cast(T, value) | ||
| if isinstance(value, str): |
Contributor
Author
There was a problem hiding this comment.
Needed to change this to get the new version of pyrefly to type narrow correctly
CorinChappy
commented
Apr 29, 2026
| value_is_json_value = is_json_value(value) | ||
| if value_is_json_value and klass is JsonValueType: | ||
| return cast(T, value) | ||
| if is_json_value(value): |
Contributor
Author
There was a problem hiding this comment.
Needed to change this to get the new version of pyrefly to type narrow correctly
15d0284 to
d5ea026
Compare
tobyclemson
approved these changes
Apr 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is extracted from #98