Skip to main content

lexigram

Async-first DI/IoC framework for Python — core package.

Lexigram demo


Overview

Lexigram is the foundation package for the wider Lexigram ecosystem. It provides the DI/IoC container, application lifecycle, configuration system, provider protocol, exception hierarchy, and structured logging foundation.

Async-first by design: application boot, provider lifecycle, I/O paths, and resolution workflows are built for async Python. Use Application.boot(...) to assemble modules and providers into a running app.

Install

uv add lexigram
# Optional extras
uv add "lexigram[security]"

Quick Start

from lexigram import Application
from lexigram.di.module import Module, module
from lexigram.app.standard import StandardModule


@module(imports=[StandardModule.configure()])
class AppModule(Module):
    pass


async with Application.boot(modules=[AppModule]) as app:
    # use app.container to resolve services
    ...

Configuration

Zero-config usage: Call StandardModule.configure() with no arguments to use defaults.

Option 1 — YAML file

# application.yaml
app_name: my-app
debug: false

Option 2 — Profiles + Environment Variables (recommended)

export LEX_PROFILE=production
# Environment variables for each field

Option 3 — Python

from lexigram.config.main import LexigramConfig

config = LexigramConfig(...)
StandardModule.configure(config_class=LexigramConfig)

Module Factory Methods

Method Description
StandardModule.configure(...) Configure with explicit config, sources, or overrides
StandardModule.build_providers() Provider list for Application.boot(providers=[...])
CoreModule.configure(...) Stripped-down kernel without serialization or concurrency

Key Features

  • DI Container — register services as singleton, transient, or scoped; resolve via await container.resolve(ServiceType)
  • Provider Lifecycleregister(), boot(), shutdown() hooks with priority ordering
  • Result PatternResult[T, E] for expected domain failures, exceptions for infrastructure errors
  • Module System — compose applications from reusable modules with explicit exports
  • Structured Logging — structlog-based logging via get_logger(__name__)
  • Configuration — Pydantic-based config with YAML, environment variables, and profile support

Testing

async with Application.boot(modules=[StandardModule.configure()]) as app:
    # your test code
    ...

Key Source Files

File What it contains
src/lexigram/app/base.py Application lifecycle and boot flow
src/lexigram/app/standard.py StandardModule.configure() with all kernel providers
src/lexigram/di/container/container.py Container registration, scope, and diagnostics
src/lexigram/result/ Result, Ok, Err, and helpers
src/lexigram/config/main.py LexigramConfig and configuration system

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lexigram-0.1.4.tar.gz (4.6 MB view details)

Uploaded Source

Built Distribution

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

lexigram-0.1.4-py3-none-any.whl (405.5 kB view details)

Uploaded Python 3

File details

Details for the file lexigram-0.1.4.tar.gz.

File metadata

  • Download URL: lexigram-0.1.4.tar.gz
  • Upload date:
  • Size: 4.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.14

File hashes

Hashes for lexigram-0.1.4.tar.gz
Algorithm Hash digest
SHA256 f04ee5547155ce17df8b235d8091bed66469e0c85d4d2c66b3110874cd5a6d1b
MD5 7073cfb8612aa6fe0fcdf34ab959e7ef
BLAKE2b-256 9f937f5e91155d7c717c2d06bab3e35fa68fcf90e19b7275dcd789d2590ebc81

See more details on using hashes here.

File details

Details for the file lexigram-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: lexigram-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 405.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.14

File hashes

Hashes for lexigram-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 2cf4fbcc4644ed05c47ecb7e006c63cbd88bf229a2c9a9c07308bc37553df663
MD5 1902fd8dbb345ab77dce54c439084974
BLAKE2b-256 74c866611d525edde1cd653d2279f5c77621aaae76cd96e1b55c24ebbdc3bc06

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.5008

1 file

0.1.5007

2 files

0.1.5005

2 files

0.1.5001

2 files

0.1.3009

2 files

0.1.3008

2 files

0.1.3007

2 files

0.1.3006

1 file

0.1.3005

1 file

0.1.3001

2 files

This release

0.1.4 This release

2 files

0.1.3

2 files

0.1.2

1 file

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page