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.46
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.46.tar.gz | 113.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ai4i_core-1.0.46-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 233.9 kB
Release files / ai4i_core-1.0.46.tar.gz
| Download URL | ai4i_core-1.0.46.tar.gz |
|---|---|
| Size | 113.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2ea9a808f836c99bbe534adab36bec7b1f80da8a9bc2b3aace2747d62dd77ec7
|
|
BLAKE2b-256 checksum How to use checksums |
1455bc7ac1293cb6b518baaf6d78bfe34555664de012a14ba002d86884e4f5f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Release files / ai4i_core-1.0.46-py3-none-any.whl
| Download URL | ai4i_core-1.0.46-py3-none-any.whl |
|---|---|
| Size | 120.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6e46d0625007fe8796814ff7e06484539ba51b1f6d122e3eab761d397719f2c9
|
|
BLAKE2b-256 checksum How to use checksums |
7c688c0578f55dc95d0209001bcf9dc8728763263a24a8e581bbce287b4b9940
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|