phx-class-registry
Factory+Registry pattern for Python classes
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 on this page — 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
phx-class-registry on PyPI
pip
pip install phx-class-registryuv
uv add phx-class-registrypoetry
poetry add phx-class-registryInstalling 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 the current Python release (>=3.12) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 94 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 145,901/month — #11,114 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: phx_class_registry-5.2.2-py3-none-any.whl
Keywords: design pattern, factory pattern, registry pattern, service registry
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
catalogueProvides lightweight function registries that…
permissive · top 1,000 on PyPI
objectoryProvides dynamic object factory implementations…
permissive · top 15,000 on PyPI
persisting-theoryPersisting-theory provides a registry system…
permissive · top 15,000 on PyPI
stevedoreStevedore manages dynamic plugin loading for…
permissive · top 1,000 on PyPI
pytest-factoryboyIntegrates factory_boy with pytest to register…
permissive · top 5,000 on PyPI
lance-namespaceProvides an abstract interface and plugin…
permissive · top 5,000 on PyPI
zope.componentImplements the core Zope Component Architecture…
unclear · top 5,000 on PyPI
keyrings.google-artifactregistry-authA keyring backend that authenticates to Google…
permissive · top 5,000 on PyPI
dataclass-factoryConverts dataclasses to and from dictionaries…
permissive · top 15,000 on PyPI
class-resolverDynamically lookup and instantiate classes by…
permissive · top 15,000 on PyPI