ai4i-core
Consolidated utility libraries for AI4I microservices — a single installable package providing the cross-cutting concerns (FastAPI bootstrap helpers, logging, observability, telemetry, exceptions, and email) shared across the AI4I backend services.
Installation
pip install ai4i-core
Subpackages
| Subpackage | Purpose |
|---|---|
ai4i_core.bootstrap |
FastAPI app-factory helpers: cache, database, Redis, health router, rate limiting, schemas, API versioning |
ai4i_core.context |
Shared contextvars (trace id, tenant id, user id, endpoint path) read by the logging and telemetry layers |
ai4i_core.email |
Provider-agnostic transactional email client (SMTP, console; pluggable providers) |
ai4i_core.exceptions |
Shared exception hierarchy, response envelope, and FastAPI exception handlers |
ai4i_core.logging |
Structured JSON logging with trace/tenant correlation and request middleware |
ai4i_core.observability |
Prometheus metrics collection and ASGI middleware |
ai4i_core.telemetry |
OpenTelemetry tracing, W3C context propagation, OpenSearch query clients |
Usage
from ai4i_core.bootstrap import create_service_app, init_database, init_redis
from ai4i_core.logging import get_logger, RequestMiddleware
from ai4i_core.exceptions import AppError, InsufficientPermissionsError
from ai4i_core.observability import setup_observability, ObservabilityMiddleware
from ai4i_core.telemetry import TraceManager, trace_stage
from ai4i_core.email import EmailClient, EmailMessage
from ai4i_core.context import get_trace_id, get_tenant_id
Each subpackage's __init__.py (__all__) lists its full public surface.
Requirements
- Python
>= 3.11
License
MIT — see LICENSE.
Links
Metadata
Release files for ai4i-core 1.0.28
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ai4i_core-1.0.28.tar.gz | 72.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ai4i_core-1.0.28-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 159.7 kB
Release files / ai4i_core-1.0.28.tar.gz
| Download URL | ai4i_core-1.0.28.tar.gz |
|---|---|
| Size | 72.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
40fbd9af4b08a9bea85b3e8750e91269bc5fec19f31f2ae9e6e095351a129462
|
|
BLAKE2b-256 checksum How to use checksums |
918a54ceac353fe2682c2703e506f773687c613f3aa73baad2b6fce14e04deac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.12
|
Release files / ai4i_core-1.0.28-py3-none-any.whl
| Download URL | ai4i_core-1.0.28-py3-none-any.whl |
|---|---|
| Size | 87.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c2f53a7f9005630a1a5a80e8474a24df8f41c2773f2bd629679af08d8ddf1c29
|
|
BLAKE2b-256 checksum How to use checksums |
24d0d93f056c644cc76838d8426546f8aec0d868ed6c624fda9856076f7add0c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.12
|