Skip to main content

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

ai4i_core-1.0.2.tar.gz (47.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ai4i_core-1.0.2-py3-none-any.whl (63.7 kB view details)

Uploaded Python 3

File details

Details for the file ai4i_core-1.0.2.tar.gz.

File metadata

  • Download URL: ai4i_core-1.0.2.tar.gz
  • Upload date:
  • Size: 47.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for ai4i_core-1.0.2.tar.gz
Algorithm Hash digest
SHA256 875e7ab84a6f2be7f481177446f5b940344373698e19b9231a19435e1f0f8711
MD5 61baa1ce9c844b6891ec8cfff804d91a
BLAKE2b-256 32707e31633c3795846ad7c3cd87a2917dc0baa52699ac3d7f5958e3d5b0c581

See more details on using hashes here.

File details

Details for the file ai4i_core-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: ai4i_core-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 63.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for ai4i_core-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b5ccd8cac54211b51577208e5f46ca16f8297b993370efb4f2e7e46575b858c3
MD5 5c3dc07144c33da1d45c94926d6e846d
BLAKE2b-256 78ddad75ab9a9586b8389e0f1929111893f7bc43d722924e9c1b43c39feae813

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page