AI4I Core - consolidated utility libraries (exceptions, logging, telemetry, observability, bootstrap, email) for AI4I microservices
Project description
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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ai4i_core-1.0.3.tar.gz.
File metadata
- Download URL: ai4i_core-1.0.3.tar.gz
- Upload date:
- Size: 48.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9137d6ba44e216f7bc8ad5a9590251dae80773b9d6c072ca66e5b15a5724e9f5
|
|
| MD5 |
faa588964a15263abde34ba5d64be77e
|
|
| BLAKE2b-256 |
a9136e14a95de5aeb9211217b542fac974a964a8554c3e1c9a7283026956b2ff
|
File details
Details for the file ai4i_core-1.0.3-py3-none-any.whl.
File metadata
- Download URL: ai4i_core-1.0.3-py3-none-any.whl
- Upload date:
- Size: 66.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
59bb015a601a99eb23bee04888d7c7aa8de9cc988ce170b4c1af5352f1379842
|
|
| MD5 |
c79a4bed2748d0db9de6af6557079457
|
|
| BLAKE2b-256 |
2bd969ae472cbd2690d5faaae6cb5e3514ff97f519645c3d86080b4250a87157
|