--- id: phx-class-registry version: "5.2.2" license: MIT license_treatment: permissive maintenance: active --- # phx-class-registry — Factory+Registry pattern for Python classes License: permissive · Maintenance: active · Downloads: 145.9K/mo ## What it is and what it does phx-class-registry provides a lightweight implementation of the Registry and Factory design patterns for Python. It lets you create a registry object, decorate classes to register them under string keys, and then instantiate those classes by key lookup. The pattern is useful for plugin systems, service locators, and any scenario where you need to dynamically select and instantiate classes at runtime based on configuration or user input. The package supports advanced features including passing constructor arguments, automatic registration of non-abstract classes, and integration with setuptools entry points to allow third-party libraries to extend your registries. With zero runtime dependencies and active maintenance, it's a straightforward tool for implementing these patterns without external complexity. Use it for: - Build a plugin system where third-party packages register handlers via entry points. - Create a service registry that maps service names to their implementation classes. - Implement a factory for different data processor classes selected by file type or format. - Define a registry of database drivers or connection strategies keyed by database name. - Build a command dispatcher that maps command strings to handler classes. - Create a polymorphic object instantiation system for configuration-driven class selection. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Implements the Registry and Factory patterns to create configurable class registries that map keys to class constructors, with optional integration into setuptools entry points for third-party extensibility. Yes. The package is actively maintained, has zero security vulnerabilities, imposes no dependency overhead, and cleanly solves a common architectural problem. It is worth installing if you need to implement registry or factory patterns in your application. The MIT license removes any legal friction. The only constraint is the Python 3.12 or later requirement. ## Install pip install phx-class-registry uv add phx-class-registry poetry add phx-class-registry ## Installing phx-class-registry Before you install: Low install friction with no runtime dependencies. Active maintenance with a recent release 94 days ago and ongoing repository activity. Requires Python 3.12 or later. License in practice: MIT license permits unrestricted use, modification, and distribution with minimal restrictions—suitable for both open-source and proprietary projects. Quickstart: pip install phx-class-registry from phx_class_registry import ClassRegistry pokedex = ClassRegistry() @pokedex.register('fire') class Charizard: pass fighter = pokedex['fire'] Requires Python 3.12 or later. Verify before relying: - Whether the package supports type hints for registry instances in practice across all supported Python versions. - Performance characteristics when registries contain hundreds or thousands of registered classes. - Exact behavior and compatibility of entry_points integration with modern setuptools versions. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 145.9K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags registry pattern python, factory pattern implementation, class registry decorator, dynamic class instantiation, service registry pattern, plugin registry system, entry points integration, design-patterns, plugin-system, factory-pattern [View on SkillFed](https://skillfed.io/packages/phx-class-registry) · [View on PyPI](https://pypi.org/project/phx-class-registry/)