Releases: SyntaxArc/ArchiPy
4.9.3
Changed
Helpers - Rate Limit
- Lazy Redis client initialization - The
FastAPIRestRateLimitHandlernow lazily initializes its Redis client to avoid import cycles and enableTYPE_CHECKINGimports.- Added
_create_redis_client()static method that importsAsyncRedisAdapterat call time with# noqa: PLC0415. - Changed from eager
self.redis_client = AsyncRedisAdapter()in__init__to lazyself._redis_clientassignment. - Renamed
redis_clientto_redis_clientto indicate private API.
- Added
Dependencies
- Core dependencies - Updated version pins for several production dependencies.
pydantic:>=2.13.3→>=2.13.4pydantic-settings:>=2.14.0→>=2.14.1requests:>=2.33.1→>=2.34.0elasticsearch:>=9.3.0→>=9.4.0boto3(minio group):>=1.43.2→>=1.43.6scylla-driver:>=3.29.9→>=3.29.10sentry-sdk:>=2.58.0→>=2.60.0
- Dev dependencies - Updated development and typing stubs.
boto3-stubs:>=1.43.2→>=1.43.6ty:>=0.0.34→>=0.0.35types-grpcio:>=1.0.0.20260408→>=1.0.0.20260508types-protobuf:>=7.34.1.20260503→>=7.34.1.20260508types-pymysql:>=1.1.0.20260408→>=1.1.0.20260508types-regex:>=2026.4.4.20260408→>=2026.5.9.20260510types-requests:>=2.33.0.20260503→>=2.33.0.20260513pymdown-extensions(docs group):>=10.21.2→>=10.21.3
Tests
Test Configuration
- Elasticsearch test container version - Updated
ELASTIC__IMAGEfromelastic/elasticsearch:9.4.0toelastic/elasticsearch:9.4.1in.env.test.
Full Changelog: 4.9.2...4.9.3
4.9.2
Changed
Configs - GrpcConfig
- Thread worker count resolution - When
THREAD_WORKER_COUNTis omitted, it is now assigned during model validation by the after-modelresolve_thread_worker_countvalidator toTHREAD_PER_CPU_CORE * (os.cpu_count() or 1).- Removed the unused
resolved_thread_worker_countproperty. - gRPC server helpers now pass a concrete
max_workersintoThreadPoolExecutorinstead ofNone.
- Removed the unused
- Default server and stub channel options - Refreshed
SERVER_OPTIONS_CONFIG_LISTandSTUB_OPTIONS_CONFIG_LISTdefaults for clearer limits, keepalive alignment, and client resilience.grpc.max_metadata_sizedefault 16KB on both server and stub presets.- Server keepalive and HTTP/2 ping intervals aligned with client expectations to reduce
ENHANCE_YOUR_CALM/ GOAWAY issues; connection idle (10m) and max age (30m) with a short grace drain. - Stub keepalive at 5 minutes with a 20s timeout;
grpc.service_configdefault timeout 10s, wait-for-ready, retry policy, and aretryThrottlingblock.
Fixed
Adapters - Saman Shaparak Payment
- Missing TransactionDetail Handling - Fixed graceful handling of missing TransactionDetail in Saman payment adapters.
- Changed from
.get("TransactionDetail", {})to.get("TransactionDetail") or {} - Prevents TypeError when API returns null instead of missing key
- Changed from
Full Changelog: 4.9.1...4.9.2
4.9.1
Fixed
Adapters - ScyllaDB
- Async Callback Fix - Fixed async error handling in ScyllaDB adapter by replacing
run_in_executorwith callback-based approach.- Uses
add_callbacksto bridge cassandra-driver's ResponseFuture to asyncio.Future - Avoids ThreadPoolExecutor bottleneck under high concurrency
- Properly constructs ResultSet from raw rows in the success callback
- Uses
Dependencies
Adapters - ScyllaDB
- ScyllaDB and Driver Upgrades - Updated ScyllaDB test container and Python driver to latest versions.
- Upgraded ScyllaDB Docker image to 2026.1.2
- Updated scylla-driver to 3.29.10
Chore - Dependencies
- Dependency Updates - Upgraded multiple Python packages for improved compatibility and security.
- Updated idna to 3.14
- Updated python-multipart to 0.0.28
- Updated requests to 2.34.0
Helpers - Tracing
- Elastic APM Initialization - Enhanced Elastic APM client initialization by excluding IS_ENABLED from model dump.
- Prevents potential configuration leaks in APM agent initialization
Full Changelog: 4.9.0...4.9.1
4.9.0
Added
Adapters - Kafka
- Null Commit and Batch Consume Support - Added support for null commits and batch consume operations in Kafka adapters.
- Implemented batch consume capability for processing multiple messages in a single operation
- Added null commit support for manual offset management scenarios
- Comprehensive BDD test coverage for the new functionality
Full Changelog: 4.8.1...4.9.0
4.8.1
Changed
Helpers - Utils
- Prometheus Utilities Refactor - Replaced standalone Prometheus helper functions with a
PrometheusUtilsclass to centralize process lifecycle and server bootstrap operations.- Updated Prometheus server management call sites in
AppUtilsand BDD step implementations - Preserved existing behavior while improving maintainability and encapsulation
- Updated Prometheus server management call sites in
Adapters - ScyllaDB
- CQL Identifier Validation - Tightened identifier sanitization in the ScyllaDB adapter to improve validation of dynamically built CQL statements.
Tests
Tests - Containers
- Test Container Setup Updates - Refined test container fixtures for Elasticsearch and MinIO to align startup configuration with current dependency expectations.
Dependencies
Dependencies - Runtime and Tooling
- Dependency Refresh - Updated core and transitive dependencies in
pyproject.tomlanduv.lock.- Upgraded
boto3and related AWS packages to1.43.4 - Upgraded
cryptographyto48.0.0
- Upgraded
Chore
Configs - Test Environment
- Elasticsearch Test Image - Updated test environment defaults to Elasticsearch
9.4.0for container-based integration tests.
4.8.0
Added
Helpers - Tracing
-
async_capture_transactionDecorator — New async-only transaction tracing decorator that enforces coroutine functions at decoration time, providing early failure detection for misuse.- Validates that decorated function is a coroutine using
inspect.iscoroutinefunction - Raises
TypeErrorimmediately at import time if a sync function is passed - Mirrors the synchronous
capture_transactionAPI withnameandopparameters
- Validates that decorated function is a coroutine using
-
async_capture_spanDecorator — New async-only span tracing decorator for capturing child operations within async transactions.- Enforces coroutine functions at decoration time
- Works with both Sentry and Elastic APM backends
- Provides detailed performance insights for async operations
-
TracingUtils.outcome_for_exceptionMethod — Added static method to determine the appropriate APM outcome string for exceptions.- Returns
OUTCOME.SUCCESSforBaseErrorexceptions with HTTP status below 500 (client errors) - Returns
OUTCOME.FAILUREfor 5xx errors or unexpected exceptions - Enables accurate transaction outcome reporting in error handling paths
- Returns
Configs - Sentry
SentryConfig.ENVIRONMENTField — Added optionalENVIRONMENTfield (str | None, defaultNone) to explicitly set the Sentry environment name.
Changed
Configs - Base Config
- Conditional Environment Assignment — Updated
BaseConfig._post_initto only setELASTIC_APM.ENVIRONMENTandSENTRY.ENVIRONMENTwhen they areNone, preserving explicitly configured values.
Helpers - Tracing Utils
- Initialization Tracking — Added
_sentry_initializedand_elastic_apm_initializedclass variables to prevent duplicate initialization attempts. - Lazy Initialization Enhancement —
init_tracing_if_needednow checks initialization state before attempting to initialise each backend.
Helpers - gRPC Interceptors
- Async gRPC Client Trace Interceptor — Changed from
elasticapm.capture_spantoelasticapm.async_capture_spanfor proper async span handling. - gRPC Server Trace Interceptor — Refactored to use
elasticapm.set_transaction_outcomewithOUTCOMEconstants instead of deprecatedtransaction.set_success()/transaction.set_failure()methods. - Async Servicer Context Wrapper — Added
_AsyncServicerContextWrapperclass to handle async gRPC server context, ensuringabort()is properly awaited in async servicer methods.
Helpers - App Utils
- Interceptor Ordering Fix — Fixed
AppUtils.create_async_grpc_appto add customized interceptors before creating the gRPC server, ensuring interceptors are properly registered.
Tests
Tests - Tracing
- Async Decorator Tests — Added comprehensive BDD test scenarios for
async_capture_transactionandasync_capture_spandecorators to verify proper transaction and span capture for async functions.
Full Changelog: 4.7.1...4.8.0
4.7.1
Added
Helpers - Tracing
TracingUtilsClass - Introduced a newTracingUtilsutility class inarchipy/helpers/utils/tracing_utils.pyto centralise all tracing initialisation and gRPC metadata helpers.is_tracing_enabled(config)— checks whether any tracing backend (Sentry, Elastic APM, or OpenTelemetry) is activeinit_tracing_if_needed(config)— lazily initialises the appropriate tracing backend once per processgrpc_status_indicates_success(status_code)— maps gRPC status codes to a boolean success/failure outcomeinject_outbound_metadata(metadata, carrier)— propagates W3C trace context into outbound gRPC metadataextract_inbound_trace(metadata_dict)— extracts and activates an inbound trace context from gRPC metadata
Configs - Sentry
- Extended
SentryConfig- Added nine new optional fields toSentryConfiginConfigTemplatefor fine-grained Sentry SDK control.SEND_DEFAULT_PII(bool, defaultFalse) — controls whether personally identifiable information (IP address, user) is sentMAX_BREADCRUMBS(int, default100) — limits the number of breadcrumbs stored per eventATTACH_STACKTRACE(bool, defaultFalse) — attaches a stack trace to every captured message, not only exceptionsSERVER_NAME(str | None, defaultNone) — overrides the hostname reported to SentryIN_APP_INCLUDE(list[str]) — module path prefixes that Sentry marks as in-app in stack tracesIN_APP_EXCLUDE(list[str]) — module path prefixes excluded from in-app markingPROFILES_SAMPLE_RATE(float, default0.0) — continuous profiling sample rate between 0.0 and 1.0IGNORE_ERRORS(list[str]) — fully qualified or short exception type names that Sentry should silenceSHUTDOWN_TIMEOUT(int, default2) — seconds the SDK waits to flush pending events on process exitDEFAULT_INTEGRATIONS(bool, defaultTrue) — toggles Sentry's automatic default integrations
Changed
Helpers - Tracing
- gRPC Client Interceptor Refactor - Rewrote
archipy/helpers/interceptors/grpc/trace/client_interceptor.pyto delegate tracing setup and metadata injection toTracingUtils, removing ~200 lines of inline logic. - gRPC Server Interceptor Refactor - Rewrote
archipy/helpers/interceptors/grpc/trace/server_interceptor.pyto useTracingUtils.extract_inbound_traceandTracingUtils.grpc_status_indicates_successfor consistent span outcome reporting. - Tracing Decorator Refactor - Updated
archipy/helpers/decorators/tracing.pyto callTracingUtils.init_tracing_if_neededinstead of duplicating Sentry and Elastic APM bootstrap logic inline.
Helpers - App Utils
- Sentry Initialisation Delegated -
AppUtils.init_sentryis now a no-op placeholder; Sentry initialisation is performed exclusively viaTracingUtilsinsidecreate_fastapi_app, preventing double-initialisation. - Elastic APM Client Reuse -
AppUtils.init_elastic_apmnow callselasticapm.get_client()first and only creates a new client when none exists, avoiding duplicate APM client instances.
Environment
.env.exampleExtended - Documented the ten newSENTRY_*environment variables introduced by the expandedSentryConfig.
Tests
Tests - Error Handling
- Consolidated Error Handling Feature - Merged four separate BDD feature files (
custom_errors.feature,error_utils.feature,fastapi_error_handling.feature,grpc_error_handling.feature) into a singleerror_handling.featurefor easier maintenance and execution.- Removed
features/custom_errors.feature,features/error_utils.feature,features/fastapi_error_handling.feature, andfeatures/grpc_error_handling.feature - Removed matching step modules
steps/custom_errors_steps.py,steps/error_utils_steps.py,steps/fastapi_error_handling_steps.py, andsteps/grpc_error_handling_steps.py - Created unified
features/error_handling.featurewith all 238 scenario lines - Created unified
features/steps/error_handling_steps.pyconsolidating all step definitions
- Removed
- Tagged Scenarios - Added descriptive tags to error handling scenarios for selective test execution.
Chore
- Elasticsearch Test Image - Updated the Elasticsearch container image version in
.env.testto align with CI test dependencies.
Full Changelog: 4.7.0...4.7.1
4.7.0
Added
Adapters - MinIO
- MinIO Copy Object - Implemented
copy_objectmethod in MinioAdapter.- Supports copying objects within and between buckets
- Added comprehensive BDD tests
Configuration
- Advanced CORS Configuration - Added advanced CORS configuration options.
- Extended
ConfigTemplatewith CORS-related settings - Added comprehensive BDD tests for CORS functionality
- Extended
Changed
Environment
- Example Environment - Updated
.env.examplewith new CORS configuration variables.- Added CORS-related environment variable documentation
Tests - App Utils
- Enhanced App Utils Tests - Added extensive BDD tests for advanced CORS configuration.
- 89 new scenario steps added
Full Changelog: 4.6.0...4.7.0
4.6.0
Added
Adapters - Payment Gateways
-
Parsian IPG Async Adapter - Added new async payment gateway adapter for Parsian integration.
- New
parsian-ipg-asyncoptional extra - SOCKS5 proxy support
- New
-
Saman IPG Async Adapter - Refactored Saman IPG adapter to use async
httpx.- Switched from synchronous
requeststo asynchttpx
- Switched from synchronous
Adapters - Ports
- Port Interface Extraction - Extracted payment gateway port interfaces and moved DTOs to ports.
- Moved DTOs to
ports.pyfor cleaner abstraction
- Moved DTOs to
Documentation - Payment Gateways
- IPG Adapters Documentation - Added async documentation for Saman and Parsian adapters.
Changed
Dependencies - Project
-
Saman IPG Extra - Switched Saman IPG extra from
requeststohttpx.saman-ipg = ["httpx[socks]>=0.28.1"]
-
Parsian IPG Extra - Added new async extra for Parsian IPG.
parsian-ipg-async = ["zeep[async]>=4.3.2", "httpx[socks]>=0.28.1"]
Tests - Containers
- Dynamic Kafka Test Container - Upgraded Kafka test container with dynamic port allocation.
- Upgraded to
apache/kafka:4.2.0
- Upgraded to
Fixed
Tests - Datetime Utils
- Datetime Utils Test Alignment - Fixed tests to match rolled-back implementation.
Full Changelog: 4.5.0...4.6.0
4.5.0
Added
Adapters - Payment Gateways
- Saman Shaparak Adapter - Added new payment gateway adapter for Saman integration.
- New
saman-ipgoptional extra - Added
SAMAN_SHAPARAK__*environment variables
- New
Helpers - Utils
- DatetimeUtils Caching Refactor - Refactored Iran holiday caching to use ClassVar.
- Removed
@ttl_cache_decoratordependency for holiday lookups - Added class-level cache with manual TTL handling
- Removed
Changed
Adapters - Kafka
- Async Method Cleanup - Removed noqa comments from async Kafka adapter methods.
- Removed
ASYNC109noqa fromflush(),list_topics(),batch_consume(),poll()
- Removed
Documentation - Payment Gateways
- Tutorial Unification - Unified payment gateway tutorials across all adapters.
Chore
Dependencies - Project
- Dependency Updates - Updated multiple package constraints.
cache:cachetools>=7.0.5→>=7.0.6fastapi:>=0.135.3→>=0.136.1minio:boto3>=1.42.89→>=1.42.96ty:>=0.0.30→>=0.0.32pre-commit:>=4.5.1→>=4.6.0ruff:>=0.15.10→>=0.15.12
Tests - Containers
- Container Update - Bumped test container version.
Full Changelog: 4.4.2...4.5.0