Skip to main content

A simple dependency injector based on type hints

Project description

HinteDI - simple dependency injection system with type hints

This package is a small utility I have been using in my own projects, a super simple tool for basic dependency injection in python based on type hints and decorators.

This package exposes three classes: HinteDI, InjectionException and InstanceSentinel. Import HinteDI and use @HinteDI.singleton and @HinteDI.instance to create dependencies and @HinteDI.inject to mark a function as requiring dependency injection. Type hint the dependencies in the injected function and HinteDI will inject the dependencies for you. You can also use @HinteDI.abstract_base, @HinteDI.singleton_implementation and @HinteDI.instance_implementation to create factory-style abstract dependencies resolvable with a set key. See the docs at GitHub pages for better documentation about the package.

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

HinteDI-0.3.2.tar.gz (8.6 kB view hashes)

Uploaded Source

Built Distribution

HinteDI-0.3.2-py3-none-any.whl (7.0 kB view hashes)

Uploaded Python 3

Supported by

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