This repository is the **Dependency Injector** library for Python, a mature and widely-used dependency injection (DI) and inversion-of-control (IoC) framework. It provides a comprehensive set of provider types (Factory, Singleton, Resource, Configuration, etc.), declarative and dynamic containers for organizing providers, and a wiring mechanism that automatically injects dependencies into functions and methods using the `@inject` decorator and `Provide`/`Closing` markers. The library is designed to decouple application components, improve testability, and manage configuration and resource lifecycles in a structured way. The core implementation is written in Cython (`.pyx` files) for performance, with pure-Python fallbacks and type stubs. The architecture is modular: providers are composable building blocks, containers assemble them, and wiring connects them to application code. The library integrates with popular web frameworks (FastAPI, Flask, Django, Aiohttp, Sanic, Starlette) and supports both synchronous and asynchronous modes. It also includes a configuration provider that can load settings from YAML, JSON, INI, environment variables, Pydantic models, and plain dictionaries, with environment variable interpolation and type casting. Key entry points are the `Provider` hierarchy (e.g., `Factory`, `Singleton`, `Resource`), `DeclarativeContainer` and `DynamicContainer` classes, and the `inject` decorator from the wiring module. The library is primarily a development dependency used at build/import time to wire up application components. It has no runtime external dependencies beyond Python itself, though optional integrations (Flask, Aiohttp, etc.) require those frameworks. The extensive test suite and documentation make it a reliable choice for projects needing explicit dependency management.
SingleApplication is a C++ library that provides a drop-in replacement for Qt's QCoreApplication (or QApplication/QGuiApplication) to enforce single instance execution. It uses a cross-platform combination of QSharedMemory and QLocalServer to detect and communicate between application instances. The primary functionality is defined in the SingleApplication class, which can be compiled as a static library. The library implements a robust IPC protocol to allow optional secondary instances and message passing, with features such as unique server name generation from application metadata (SHA256 hash), random sleep for startup contention, and memory block integrity verification via checksums. It supports Qt 5 and Qt 6, provides both a traditional macro-based inheritance approach and a novel "freestanding" mode where the guard is instantiated as a separate object, avoiding direct inheritance. CI tests cover build and integration on Windows, macOS, and Linux. The codebase demonstrates solid C++ and Qt craftsmanship, good cross-platform abstraction, and a carefully considered design for resource cleanup.
Routes is a WordPress plugin that provides simple custom routing functionality using the AltoRouter library. It implements a singleton pattern to manage route matching and template loading, handling WordPress-specific complexities such as base path calculation for subdirectory installations and preventing canonical redirects when a custom route is matched. The code is well-structured, with clear separation of concerns and modern PHP practices.