objectory


Nameobjectory JSON
Version 0.1.2 PyPI version JSON
download
home_pagehttps://github.com/durandtibo/objectory
SummaryA light library for general purpose object factories
upload_time2023-12-31 07:35:58
maintainer
docs_urlNone
authorThibaut Durand
requires_python>=3.9,<3.13
licenseBSD-3-Clause
keywords factory abstract factory registry
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # objectory = object + factory

<p align="center">
    <a href="https://github.com/durandtibo/objectory/actions">
        <img alt="CI" src="https://github.com/durandtibo/objectory/workflows/CI/badge.svg">
    </a>
    <a href="https://durandtibo.github.io/objectory/">
        <img alt="Documentation" src="https://github.com/durandtibo/objectory/workflows/Documentation/badge.svg">
    </a>
    <a href="https://github.com/durandtibo/objectory/actions">
        <img alt="Nightly Tests" src="https://github.com/durandtibo/objectory/workflows/Nightly%20Tests/badge.svg">
    </a>
    <a href="https://github.com/durandtibo/objectory/actions">
        <img alt="Nightly Package Tests" src="https://github.com/durandtibo/objectory/workflows/Nightly%20Package%20Tests/badge.svg">
    </a>
    <br/>
    <a href="https://codecov.io/gh/durandtibo/objectory">
        <img alt="Codecov" src="https://codecov.io/gh/durandtibo/objectory/branch/main/graph/badge.svg">
    </a>
    <a href="https://codeclimate.com/github/durandtibo/objectory/maintainability">
        <img src="https://api.codeclimate.com/v1/badges/1fad6e22f2d38335c26d/maintainability" />
    </a>
    <a href="https://codeclimate.com/github/durandtibo/objectory/test_coverage">
        <img src="https://api.codeclimate.com/v1/badges/1fad6e22f2d38335c26d/test_coverage" />
    </a>
    <br/>
    <a href="https://github.com/psf/black">
        <img  alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg">
    </a>
    <a href="https://google.github.io/styleguide/pyguide.html#s3.8-comments-and-docstrings">
        <img  alt="Doc style: google" src="https://img.shields.io/badge/%20style-google-3666d6.svg">
    </a>
    <a href="https://github.com/astral-sh/ruff">
        <img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" alt="Ruff" style="max-width:100%;">
    </a>
    <a href="https://github.com/guilatrova/tryceratops">
        <img  alt="Doc style: google" src="https://img.shields.io/badge/try%2Fexcept%20style-tryceratops%20%F0%9F%A6%96%E2%9C%A8-black">
    </a>
    <br/>
    <a href="https://pypi.org/project/objectory/">
        <img alt="PYPI version" src="https://img.shields.io/pypi/v/objectory">
    </a>
    <a href="https://pypi.org/project/objectory/">
        <img alt="Python" src="https://img.shields.io/pypi/pyversions/objectory.svg">
    </a>
    <a href="https://opensource.org/licenses/BSD-3-Clause">
        <img alt="BSD-3-Clause" src="https://img.shields.io/pypi/l/objectory">
    </a>
    <br/>
    <a href="https://pepy.tech/project/objectory">
        <img  alt="Downloads" src="https://static.pepy.tech/badge/objectory">
    </a>
    <a href="https://pepy.tech/project/objectory">
        <img  alt="Monthly downloads" src="https://static.pepy.tech/badge/objectory/month">
    </a>
    <br/>
</p>

## 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**

```pycon
>>> from objectory import factory
>>> obj = factory("builtins.list")
>>> print(obj)
[]

```

**[abstract factory](https://durandtibo.github.io/objectory/abstract_factory/)**

```pycon
>>> from objectory import AbstractFactory
>>> class BaseClass(metaclass=AbstractFactory):
...     pass
...
>>> class MyClass(BaseClass):
...     pass
...
>>> obj = BaseClass.factory("MyClass")
>>> print(obj)
<__main__.MyClass object at 0x...>

```

**[registry](https://durandtibo.github.io/objectory/registry/)**

```pycon
>>> 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](https://durandtibo.github.io/objectory/) to learn more about these
approaches.

- [Documentation](https://durandtibo.github.io/objectory/)
- [Installation](#installation)
- [Contributing](#contributing)
- [API stability](#api-stability)
- [License](#license)

## Installation

We highly recommend installing
a [virtual environment](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/).
`objectory` can be installed from pip using the following command:

```shell
pip install objectory
```

It is highly recommended to use the last stable version available.
Please check the [get started page](https://durandtibo.github.io/objectory/get_started) to see other
alternatives to install the library.
The following is the corresponding `objectory` versions and supported dependencies.

| `objectory` | `tornado`    | `python`      |
|-------------|--------------|---------------|
| `main`      | `>=6.0,<7.0` | `>=3.9,<3.13` |
| `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](.github/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](LICENSE)
file.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/durandtibo/objectory",
    "name": "objectory",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9,<3.13",
    "maintainer_email": "",
    "keywords": "factory,abstract factory,registry",
    "author": "Thibaut Durand",
    "author_email": "durand.tibo+gh@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/a8/51/3bc02c45b770df9996ab7ae2911296fb59c5797a131c6cd3061665b888ee/objectory-0.1.2.tar.gz",
    "platform": null,
    "description": "# objectory = object + factory\n\n<p align=\"center\">\n    <a href=\"https://github.com/durandtibo/objectory/actions\">\n        <img alt=\"CI\" src=\"https://github.com/durandtibo/objectory/workflows/CI/badge.svg\">\n    </a>\n    <a href=\"https://durandtibo.github.io/objectory/\">\n        <img alt=\"Documentation\" src=\"https://github.com/durandtibo/objectory/workflows/Documentation/badge.svg\">\n    </a>\n    <a href=\"https://github.com/durandtibo/objectory/actions\">\n        <img alt=\"Nightly Tests\" src=\"https://github.com/durandtibo/objectory/workflows/Nightly%20Tests/badge.svg\">\n    </a>\n    <a href=\"https://github.com/durandtibo/objectory/actions\">\n        <img alt=\"Nightly Package Tests\" src=\"https://github.com/durandtibo/objectory/workflows/Nightly%20Package%20Tests/badge.svg\">\n    </a>\n    <br/>\n    <a href=\"https://codecov.io/gh/durandtibo/objectory\">\n        <img alt=\"Codecov\" src=\"https://codecov.io/gh/durandtibo/objectory/branch/main/graph/badge.svg\">\n    </a>\n    <a href=\"https://codeclimate.com/github/durandtibo/objectory/maintainability\">\n        <img src=\"https://api.codeclimate.com/v1/badges/1fad6e22f2d38335c26d/maintainability\" />\n    </a>\n    <a href=\"https://codeclimate.com/github/durandtibo/objectory/test_coverage\">\n        <img src=\"https://api.codeclimate.com/v1/badges/1fad6e22f2d38335c26d/test_coverage\" />\n    </a>\n    <br/>\n    <a href=\"https://github.com/psf/black\">\n        <img  alt=\"Code style: black\" src=\"https://img.shields.io/badge/code%20style-black-000000.svg\">\n    </a>\n    <a href=\"https://google.github.io/styleguide/pyguide.html#s3.8-comments-and-docstrings\">\n        <img  alt=\"Doc style: google\" src=\"https://img.shields.io/badge/%20style-google-3666d6.svg\">\n    </a>\n    <a href=\"https://github.com/astral-sh/ruff\">\n        <img src=\"https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json\" alt=\"Ruff\" style=\"max-width:100%;\">\n    </a>\n    <a href=\"https://github.com/guilatrova/tryceratops\">\n        <img  alt=\"Doc style: google\" src=\"https://img.shields.io/badge/try%2Fexcept%20style-tryceratops%20%F0%9F%A6%96%E2%9C%A8-black\">\n    </a>\n    <br/>\n    <a href=\"https://pypi.org/project/objectory/\">\n        <img alt=\"PYPI version\" src=\"https://img.shields.io/pypi/v/objectory\">\n    </a>\n    <a href=\"https://pypi.org/project/objectory/\">\n        <img alt=\"Python\" src=\"https://img.shields.io/pypi/pyversions/objectory.svg\">\n    </a>\n    <a href=\"https://opensource.org/licenses/BSD-3-Clause\">\n        <img alt=\"BSD-3-Clause\" src=\"https://img.shields.io/pypi/l/objectory\">\n    </a>\n    <br/>\n    <a href=\"https://pepy.tech/project/objectory\">\n        <img  alt=\"Downloads\" src=\"https://static.pepy.tech/badge/objectory\">\n    </a>\n    <a href=\"https://pepy.tech/project/objectory\">\n        <img  alt=\"Monthly downloads\" src=\"https://static.pepy.tech/badge/objectory/month\">\n    </a>\n    <br/>\n</p>\n\n## Overview\n\nA Python library for general purpose object factories.\nIn particular, it focuses on dynamic object factory implementations where objects can be registered\ndynamically without changing the code of the factory.\nAn object factory can be used to instantiate an object from its configuration.\nThe current implementation contains both abstract factory and registry approaches.\n\n**factory**\n\n```pycon\n>>> from objectory import factory\n>>> obj = factory(\"builtins.list\")\n>>> print(obj)\n[]\n\n```\n\n**[abstract factory](https://durandtibo.github.io/objectory/abstract_factory/)**\n\n```pycon\n>>> from objectory import AbstractFactory\n>>> class BaseClass(metaclass=AbstractFactory):\n...     pass\n...\n>>> class MyClass(BaseClass):\n...     pass\n...\n>>> obj = BaseClass.factory(\"MyClass\")\n>>> print(obj)\n<__main__.MyClass object at 0x...>\n\n```\n\n**[registry](https://durandtibo.github.io/objectory/registry/)**\n\n```pycon\n>>> from objectory import Registry\n>>> registry = Registry()\n>>> @registry.register()\n... class MyClass:\n...     pass\n...\n>>> obj = registry.factory(\"MyClass\")\n>>> print(obj)\n<__main__.MyClass object at 0x...>\n\n```\n\nPlease read the [documentation](https://durandtibo.github.io/objectory/) to learn more about these\napproaches.\n\n- [Documentation](https://durandtibo.github.io/objectory/)\n- [Installation](#installation)\n- [Contributing](#contributing)\n- [API stability](#api-stability)\n- [License](#license)\n\n## Installation\n\nWe highly recommend installing\na [virtual environment](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/).\n`objectory` can be installed from pip using the following command:\n\n```shell\npip install objectory\n```\n\nIt is highly recommended to use the last stable version available.\nPlease check the [get started page](https://durandtibo.github.io/objectory/get_started) to see other\nalternatives to install the library.\nThe following is the corresponding `objectory` versions and supported dependencies.\n\n| `objectory` | `tornado`    | `python`      |\n|-------------|--------------|---------------|\n| `main`      | `>=6.0,<7.0` | `>=3.9,<3.13` |\n| `0.1.2`     | `>=6.0,<7.0` | `>=3.9,<3.13` |\n| `0.1.1`     | `>=6.0,<7.0` | `>=3.9,<3.13` |\n| `0.1.0`     | `>=6.0,<7.0` | `>=3.9,<3.13` |\n| `0.0.9`     | `>=6.0,<7.0` | `>=3.9,<3.13` |\n| `0.0.8`     | `>=6.0,<7.0` | `>=3.9,<3.13` |\n| `0.0.7`     | `>=6.0,<7.0` | `>=3.9,<3.12` |\n\n## Contributing\n\nPlease check the instructions in [CONTRIBUTING.md](.github/CONTRIBUTING.md).\n\n## API stability\n\n:warning: While `objectory` is in development stage, no API is guaranteed to be stable from one\nrelease to the next.\nIn fact, it is very likely that the API will change multiple times before a stable 1.0.0 release.\nIn practice, this means that upgrading `objectory` to a new version will possibly break any code\nthat was using the old version of `objectory`.\n\n## License\n\n`objectory` is licensed under BSD 3-Clause \"New\" or \"Revised\" license available\nin [LICENSE](LICENSE)\nfile.\n",
    "bugtrack_url": null,
    "license": "BSD-3-Clause",
    "summary": "A light library for general purpose object factories",
    "version": "0.1.2",
    "project_urls": {
        "Homepage": "https://github.com/durandtibo/objectory",
        "Repository": "https://github.com/durandtibo/objectory"
    },
    "split_keywords": [
        "factory",
        "abstract factory",
        "registry"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "53cd6077a6b7c82b7b23f79af5ae0f8cd058f0055388b77ca4b571c39ccae420",
                "md5": "2083b83118097104c6d087de3cb40dd3",
                "sha256": "b7ead22aa40b93193238b8642fac9ec8c1293e6bedf9cc86e799bd9afd7c887a"
            },
            "downloads": -1,
            "filename": "objectory-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2083b83118097104c6d087de3cb40dd3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9,<3.13",
            "size": 17391,
            "upload_time": "2023-12-31T07:35:57",
            "upload_time_iso_8601": "2023-12-31T07:35:57.433693Z",
            "url": "https://files.pythonhosted.org/packages/53/cd/6077a6b7c82b7b23f79af5ae0f8cd058f0055388b77ca4b571c39ccae420/objectory-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a8513bc02c45b770df9996ab7ae2911296fb59c5797a131c6cd3061665b888ee",
                "md5": "9178d9de33f0847ad0e0908c1975d3d1",
                "sha256": "1903db68b486e5efefa0b412bcac058fe6624a4ed27f42334c625937692fc6d4"
            },
            "downloads": -1,
            "filename": "objectory-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "9178d9de33f0847ad0e0908c1975d3d1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9,<3.13",
            "size": 15310,
            "upload_time": "2023-12-31T07:35:58",
            "upload_time_iso_8601": "2023-12-31T07:35:58.529393Z",
            "url": "https://files.pythonhosted.org/packages/a8/51/3bc02c45b770df9996ab7ae2911296fb59c5797a131c6cd3061665b888ee/objectory-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-31 07:35:58",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "durandtibo",
    "github_project": "objectory",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "objectory"
}
        
Elapsed time: 0.17839s