Registry / serialization / objectory

objectory

JSON →
library0.3.1pypypi✓ verified 84d ago

Objectory is a lightweight Python library (version 0.3.1) designed for general-purpose object factories. It focuses on dynamic object factory implementations, allowing objects to be registered and instantiated from their configuration without altering the factory's core code. The library supports both abstract factory and registry patterns. As it is currently in a development stage (pre-1.0.0), the API may experience frequent changes.

pip install objectory
INSTALL
IMPORT
SIG · OBJECTORY
O
objectory
serializationpythonv0.3.1
Install
1.7s avg
Import
128ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.3.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
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.133s · 17.9MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 1.7s · import 0.123s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

factory
from objectory import factory
AbstractFactory
from objectory import AbstractFactory
Registry
from objectory import Registry

Demonstrates the three main ways to use Objectory: direct factory instantiation, abstract factory inheritance, and dynamic class registration with a Registry.

from objectory import factory, AbstractFactory, Registry # 1. Basic factory usage with a built-in type obj_list = factory("builtins.list") print(f"Created list: {obj_list}") obj_list_init = factory("builtins.list", [1, 2, 3]) print(f"Created list with data: {obj_list_init}") # 2. AbstractFactory pattern class BaseProduct(metaclass=AbstractFactory): pass class ConcreteProductA(BaseProduct): def __init__(self, name="ProductA"): self.name = name class ConcreteProductB(BaseProduct): def __init__(self, value=100): self.value = value product_a = BaseProduct.factory("ConcreteProductA", name="SpecialA") print(f"Created product A: {product_a.name}") product_b = BaseProduct.factory("ConcreteProductB") print(f"Created product B value: {product_b.value}") # 3. Registry pattern my_registry = Registry() @my_registry.register() class RegisteredClass: def __init__(self, message="Hello from registry!"): self.message = message registered_instance = my_registry.factory("RegisteredClass", message="Dynamic message!") print(f"Created registered instance: {registered_instance.message}")
Debug
Known issues
breakingObjectory is in a pre-1.0.0 development stage, and its API is not guaranteed to be stable. Upgrading to new versions may introduce breaking changes, requiring code modifications.
fix
Always review the changelog and release notes when upgrading to new versions, and thoroughly test your application. Pin exact versions in your `requirements.txt`.
affects: <1.0.0
gotchaWhen using `factory` with string identifiers (e.g., 'module.ClassName'), ensure the specified module is importable and the class/function exists within it. Incorrect paths or missing imports will lead to runtime errors.
fix
Double-check the string path for accuracy. For custom classes, ensure the module containing them has been imported at some point before the factory attempts to instantiate them, or that the classes are directly registered if using `Registry`.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'objectory'
The 'objectory' package is not installed in your current Python environment.
fix
Run `pip install objectory` to install the library.
ValueError: Cannot create object for type 'NonExistentClass'
The string identifier passed to `factory` or `Registry.factory` does not correspond to an existing or registered class/function.
fix
Verify that 'NonExistentClass' is correctly spelled, accessible in the current scope, or properly registered with the `Registry` or `AbstractFactory` base class.
TypeError: __init__() missing X required positional arguments
The arguments provided to `factory` (or `AbstractFactory.factory`, `Registry.factory`) do not match the `__init__` signature of the class being instantiated.
fix
Ensure that the `*args` and `**kwargs` passed to the factory method align with the constructor requirements of the target class.
Upgrade
Version history
0.3.1latest on PyPI · released Dec 19, 2025
Audit
Dependencies
pythonrequiredRequires Python 3.10 or newer.
Agent activity
4 hits · last 30 days
node
4
Resources
objectory — pip install objectory · libregistry