Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Injex is a lightweight and easy-to-use Dependency Injection (DI) container for Python applications. It simplifies dependency management, making your code more modular, testable, and maintainable. Injex is inspired by popular DI frameworks in other programming languages and brings similar capabilities to Python.
🌟 Simple API: Easy to understand and use. 🔄 Multiple Lifestyles: Support for singleton, transient, and scoped services. 🧩 Flexible Registrations: Register services, factories, and instances. 🏷️ Named Registrations: Register multiple implementations of the same interface using names. 🔍 Property Injection: Inject dependencies into properties after object creation. 🛠 Optional Dependencies: Handle optional dependencies gracefully. 🚀 No External Dependencies: Pure Python implementation without third-party packages.
pip install injex
Dependency Injection is a design pattern that helps in:
Here's a simple example of usage Injex:
from abc import ABC, abstractmethod
from injex import Container
class IService(ABC):
@abstractmethod
def perform_action(self):
pass
class ServiceImplementation(IService):
def perform_action(self):
print("Service is performing an action.")
container = Container()
container.add_transient(IService, ServiceImplementation)
service = container.resolve(IService)
service.perform_action() # output: Service is performing an action.
Another examples in examples folder.
For detailed documentation on all functionalities, usage examples, and best practices, please refer to the Documentation.
Contributions are welcome! Please open an issue or submit a pull request on GitHub.
FAQs
DI container for Python applications
We found that injex demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.