Releases: aipartnerup/apcore-python
Releases · aipartnerup/apcore-python
Release 0.5.0
Changed
API Naming
- decorator - Renamed
_generate_input_model/_generate_output_modeltogenerate_input_model/generate_output_modelas public API - context_logger - Renamed
formatparameter tooutput_formatto avoid shadowing Python builtin - registry - Renamed
_write_lockto_lockfor clearer intent
Type Annotations
- decorator - Replaced bare
dictwithdict[str, Any]in_normalize_result,annotations,metadata,_async_execute,_sync_execute - bindings - Fixed
_build_model_from_json_schemaparameter type fromdicttodict[str, Any] - scanner - Fixed
rootsparameter type fromlist[dict]tolist[dict[str, Any]] - metrics - Fixed
snapshotreturn type fromdicttodict[str, Any] - executor - Removed redundant string-quoted forward references in
from_registry; fixedmiddlewaresparameter type tolist[Middleware] | None
Code Quality
- executor - Extracted
_convert_validation_errors()helper to eliminate 6 duplicated validation error conversion patterns - executor - Refactored
call_async()andstream()to use new async middleware manager methods - executor - Removed internal
_execute_on_error_asyncmethod (replaced byMiddlewareManager.execute_on_error_async) - loader - Use
self._resolver.clear_cache()instead of accessing private_file_cachedirectly - tracing - Replaced
print()withsys.stdout.write()inStdoutExporter - acl / loader - Changed hardcoded logger names to
logging.getLogger(__name__)
Added
Async Middleware
- MiddlewareManager - Added
execute_before_async(),execute_after_async(),execute_on_error_async()for proper async middleware dispatch withinspect.iscoroutinefunctiondetection - RefResolver - Added
clear_cache()public method for cache management - Executor - Added
clear_async_cache()public method
Schema Export
- SchemaExporter - Added
streaminghint toexport_mcp()annotations fromModuleAnnotations
Fixed
Memory Safety
- context - Changed
Identity.rolesfrom mutablelist[str]to immutabletuple[str, ...]in frozen dataclass
Observability
- context_logger / metrics - Handle cases where
before()was never called inObsLoggingMiddlewareandMetricsMiddleware
Security
- acl - Added explicit
encoding="utf-8"to YAML file open
Release 0.4.0
Added
Streaming Support
- Executor.stream() - New async generator method for streaming module execution
- Implements same 6-step pipeline as
call_async()(context, safety, lookup, ACL, input validation, middleware before) - Falls back to
call_async()yielding single chunk for non-streaming modules - For streaming modules, iterates
module.stream()and yields each chunk - Accumulates chunks via shallow merge for output validation and after-middleware
- Full error handling with middleware recovery
- ModuleAnnotations.streaming - New
streaming: bool = Falsefield to indicate if a module supports streaming execution - Test coverage - Added 5 comprehensive tests in
test_executor_stream.py: - Fallback behavior for non-streaming modules
- Multi-chunk streaming
- Module not found error handling
- Before/after middleware integration
- Disjoint key accumulation via shallow merge
Release 0.3.0
Release version 0.3.0
See CHANGELOG.md for details.