NexusDI
A lightweight and powerful dependency injection framework for Python
NexusDI provides elegant dependency injection with support for multiple lifecycles, automatic dependency resolution, component scanning, and circular dependency handling via lazy proxies.
✨ Key Features
- 🔄 Multiple Lifecycles: Singleton, transient, and scoped dependencies
- ⚡ Automatic Resolution: Type-hint based dependency resolution
- ♻️ Circular Dependencies: Lazy proxies to handle complex graphs
- 🔍 Component Scanning: Auto-discovery of decorated components
- 🧵 Thread-Safe: Reliable for concurrent applications
- 💡 Lightweight: Minimal overhead with maximum flexibility
🚀 Quick Example
from nexusdi import singleton, transient, inject, initialize
@singleton
class DatabaseService:
def __init__(self):
self.connection = "database_connection"
@transient
class UserRepository:
def __init__(self, db_service: DatabaseService):
self.db = db_service
def get_user(self, user_id: int):
return f"User {user_id} from {self.db.connection}"
@inject
def get_user_data(user_repo: UserRepository, user_id: int = 1):
return user_repo.get_user(user_id)
# Initialize the DI system
initialize()
# Dependencies are automatically injected
result = get_user_data(user_id=123)
print(result) # "User 123 from database_connection"
📦 Installation
Install NexusDI with pip:
pip install nexusdi
Or with poetry:
poetry add nexusdi
🎯 Core Concepts
Lifecycles
singleton: A single instance for the application lifetimetransient: A new instance per requestscoped: Shared within a defined scope
Injection
- Use
@injecton functions to resolve dependencies automatically
Scanning
- Decorate classes to enable automatic component discovery
Circular Dependencies
- NexusDI resolves circular graphs via lazy proxies
🔗 Quick Links
- Getting Started – Install and set up NexusDI
- User Guide – Explore lifecycles, injection, and more
- API Reference – Complete API documentation
- Examples – See practical usage examples
🤝 Contributing
Contributions are welcome! Please feel free to open an issue or submit a Pull Request.
📄 License
This project is licensed under the MIT License – see the LICENSE file for details.
👤 Author
Harrison Alonso Arroyave Gaviria
- GitHub: @harrison-gaviria
- LinkedIn: Harrison Alonso Arroyave Gaviria
- Email: harrisonarroyaveg@gmail.com
Metadata
Release files for nexusdi 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nexusdi-0.0.1.tar.gz | 13.6 kB | Without provenance | Details for nexusdi-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nexusdi-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for nexusdi-0.0.1-py3-none-any.whl |
Total release size: 28.9 kB
Release files / nexusdi-0.0.1.tar.gz
| Download URL | nexusdi-0.0.1.tar.gz |
|---|---|
| Size | 13.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e0917202c55a859d2c9e5ff37e57a3d93ed246856b1f4e9d318ff4e98d8d0901
|
|
BLAKE2b-256 checksum How to use checksums |
cc796c340e75b9e1ae108b944ee27f9cdcdd4df0276dce4824126c6c0778f627
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.9
|
Release files / nexusdi-0.0.1-py3-none-any.whl
| Download URL | nexusdi-0.0.1-py3-none-any.whl |
|---|---|
| Size | 15.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
561a26f3d442dd82fd8ba39dc01bf04949016cf69403363aaf317fbffede4fd9
|
|
BLAKE2b-256 checksum How to use checksums |
1dcea6cd7a197f27842e63ffb21bc49e5d0201743ff6eb9cc728cdaf1106f5ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.9
|
Security for nexusdi 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.