Install & Compatibility
Where this runs
tested against v0.7.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.132s · 18.3MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 1.6s · import 0.116s · 19MB
16MB installed
● package 16MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
ClassResolver
✓ from class_resolver import ClassResolver
Hint
✓ from class_resolver import Hint
Resolver
✓ from class_resolver import Resolver
Contributions
✓ from class_resolver import Contributions
Optional
✓ from class_resolver import Optional
Create a resolver from a base class or a list of classes, then look up and instantiate by registered name.
from class_resolver import ClassResolver
class MyModel:
name = 'my_model'
class AnotherModel:
name = 'another_model'
resolver = ClassResolver.from_subclasses(MyModel)
# Or manually:
# resolver = ClassResolver([MyModel, AnotherModel])
# Look up by name or class
model_class = resolver.lookup('my_model')
# Instantiate with parameters
instance = resolver.make('my_model', param1=10)
print(instance)
Errors
Common errors & fixes
AttributeError: module 'class_resolver' has no attribute 'ClassResolver'
Misspelled or incorrect import name. The module is `class_resolver` (with underscore), not `classresolver`.
fix`from class_resolver import ClassResolver`
KeyError: 'xyz'
Attempted to lookup a class that is not registered in the resolver.
fixCheck registered names with `resolver.names` or ensure the class is properly added.
TypeError: __init__() got an unexpected keyword argument 'unexpected'
Passed an unexpected keyword argument to `resolver.make()`. In versions >=0.7.0, extra kwargs are passed to the constructor, which may cause an error if the class does not accept them.
fixRemove unexpected kwargs or filter them before calling `make()`.
Upgrade
Version history
0.7.1latest on PyPI · released Aug 28, 2025
Audit
Dependencies
No dependency data recorded yet.