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.4.tar.gz (48.7 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.4-py3-none-any.whl (66.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ai4i_core-1.0.4.tar.gz
  • Upload date:
  • Size: 48.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0rc1

File hashes

Hashes for ai4i_core-1.0.4.tar.gz
Algorithm Hash digest
SHA256 2ad105a147cf3670d474e8fcf2cb86bbe6d31ef24d22b3b9776d608d3fb25963
MD5 2a1b0c92e8098605b47cdb21b93700c5
BLAKE2b-256 e63a5aa6c970e6ad992ed3d9d2278d239e99f99c22ec7d79b8b6c7dde599761b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ai4i_core-1.0.4-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.11.0rc1

File hashes

Hashes for ai4i_core-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 89e78a320223ec9571a389dd269f8991169c3c94e097d2902f686c0708aabf08
MD5 a6c752dc7074fb728e861c821cdb8b18
BLAKE2b-256 596c7f849e491a8e3aba38f02d5d75d178eb4e1adef078fd8bc6fc2f604f6bb6

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