objectory = object + factory
Overview
A Python library for general purpose object factories. In particular, it focuses on dynamic object factory implementations where objects can be registered dynamically without changing the code of the factory. An object factory can be used to instantiate an object from its configuration. The current implementation contains both abstract factory and registry approaches.
factory
>>> from objectory import factory
>>> obj = factory("builtins.list")
>>> print(obj)
[]
>>> obj = factory("builtins.list", [4, 2])
>>> print(obj)
[4, 2]
>>> from objectory import AbstractFactory
>>> class BaseClass(metaclass=AbstractFactory):
... pass
...
>>> class MyClass(BaseClass):
... pass
...
>>> obj = BaseClass.factory("MyClass")
>>> print(obj)
<__main__.MyClass object at 0x...>
>>> from objectory import Registry
>>> registry = Registry()
>>> @registry.register()
... class MyClass:
... pass
...
>>> obj = registry.factory("MyClass")
>>> print(obj)
<__main__.MyClass object at 0x...>
Please read the documentation to learn more about these approaches.
Installation
We highly recommend installing
a virtual environment.
objectory can be installed from pip using the following command:
pip install objectory
It is highly recommended to use the last stable version available.
Please check the get started page to see other
alternatives to install the library.
The following is the corresponding objectory versions and supported dependencies.
objectory |
tornado |
python |
|---|---|---|
main |
>=3.10 |
|
0.3.1 |
>=3.10 |
|
0.3.0 |
>=3.10 |
|
0.2.2 |
>=6.0,<7.0 |
>=3.10,<3.15 |
0.2.1 |
>=6.0,<7.0 |
>=3.10,<3.15 |
0.2.0 |
>=6.0,<7.0 |
>=3.9,<3.14 |
older versions
objectory |
tornado |
python |
|---|---|---|
0.1.2 |
>=6.0,<7.0 |
>=3.9,<3.13 |
0.1.1 |
>=6.0,<7.0 |
>=3.9,<3.13 |
0.1.0 |
>=6.0,<7.0 |
>=3.9,<3.13 |
0.0.9 |
>=6.0,<7.0 |
>=3.9,<3.13 |
0.0.8 |
>=6.0,<7.0 |
>=3.9,<3.13 |
0.0.7 |
>=6.0,<7.0 |
>=3.9,<3.12 |
Contributing
Please check the instructions in CONTRIBUTING.md.
API stability
:warning: While objectory is in development stage, no API is guaranteed to be stable from one
release to the next.
In fact, it is very likely that the API will change multiple times before a stable 1.0.0 release.
In practice, this means that upgrading objectory to a new version will possibly break any code
that was using the old version of objectory.
License
objectory is licensed under BSD 3-Clause "New" or "Revised" license available
in LICENSE
file.
Metadata
Release files for objectory 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| objectory-0.3.1.tar.gz | 16.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| objectory-0.3.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 37.3 kB
Release files / objectory-0.3.1.tar.gz
| Download URL | objectory-0.3.1.tar.gz |
|---|---|
| Size | 16.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c3b4f387db31470058d8b34d930daeaacb25eb09384c1e266eaf62ca5b15fc8b
|
|
BLAKE2b-256 checksum How to use checksums |
2038f46a0603c7f59ffea5c44d0bd2f484c1ed2ecbd44a0c3b6cd61ef41d781e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / objectory-0.3.1-py3-none-any.whl
| Download URL | objectory-0.3.1-py3-none-any.whl |
|---|---|
| Size | 20.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
663a433c7c8ac4971617a61be4f0a9c258bd518bea00bf9eb3f337504ac4c7ce
|
|
BLAKE2b-256 checksum How to use checksums |
d54d35db369f225cc44df8fd1a7b06b332da3aefe5ed5b9db512046bf195d0a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|