Skip to content

msqd/hdmi

Repository files navigation

hdmi

Lightweight dependency injection for Python 3.13+

PyPI version Python versions CI Documentation License

Warning: Pre-Alpha Software

hdmi is experimental software in active development. Breaking changes may occur until version 1.0.

Documentation: Full Docs | Getting Started | API Reference

Features

  • Type-driven dependency discovery — Uses Python's standard type annotations, no decorators needed
  • Scope-aware validation — Prevents lifetime bugs at container build time
  • Lazy instantiation — Services created just-in-time when first resolved
  • Two-phase architecture — Configuration separated from runtime for immutable, validated graphs

Quick Start

pip install hdmi
import asyncio
from hdmi import ContainerBuilder

class DatabaseConnection:
    def __init__(self):
        self.connected = True

class UserRepository:
    def __init__(self, db: DatabaseConnection):
        self.db = db

class UserService:
    def __init__(self, repo: UserRepository):
        self.repo = repo

async def main():
    builder = ContainerBuilder()
    builder.register(DatabaseConnection)
    builder.register(UserRepository)
    builder.register(UserService)

    container = builder.build()  # Validates the dependency graph
    user_service = await container.get(UserService)  # Auto-wired!

asyncio.run(main())

For scoped services (per-request lifecycles), transient services, and scope validation rules, see the documentation.

Development

This project follows strict TDD methodology. See CONTRIBUTING.md for details.

make test    # Run all tests
make docs    # Build documentation
make help    # Show all available commands

License

MIT License — see LICENSE for details.

About

Dependency injection framework for Python 3.13+. EXPERIMENTAL / PRE-ALPHA

Topics

Resources

License

Stars

Watchers

Forks

Contributors