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.5.tar.gz (49.0 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.5-py3-none-any.whl (66.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ai4i_core-1.0.5.tar.gz
  • Upload date:
  • Size: 49.0 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.5.tar.gz
Algorithm Hash digest
SHA256 dffa8afe32987bd2aee0a51ad35ec1cd2205a046f303ada528fb30ccad6e4d60
MD5 75f3ca5f77d174dc01394529d10cd20c
BLAKE2b-256 508b236c0809b4e973ea136b4dfa1495a648acb365f45f607897557c757b7e33

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ai4i_core-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 66.5 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 e45db86b2d1e3cb794eabcf2c172f05e1562c96238472c814b5d8e6cb00fc7af
MD5 0c2f6db0d1f2fb7674b2a860433c4e1e
BLAKE2b-256 ae0468fb643f996641f82d8a1162f234f45142fdbd007734bb66248aad654c09

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