gimme-that


Namegimme-that JSON
Version 0.3.1 PyPI version JSON
download
home_pagehttps://github.com/elfjes/gimme-that
SummarySimple and flexible dependency injection framework.
upload_time2023-01-19 18:08:34
maintainer
docs_urlNone
authorPelle Koster
requires_python>=3.6
licenseMIT
keywords inversion-of-control ioc di dependency-injection
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            .. image:: https://github.com/elfjes/gimme-that/actions/workflows/main.yml/badge.svg?branch=master
  :target: https://github.com/elfjes/gimme-that/actions/workflows/main.yml
  :alt: Github Actions

.. image:: https://badge.fury.io/py/gimme-that.svg
  :target: https://pypi.org/project/gimme-that
  :alt: PyPI - Package version

.. image:: https://img.shields.io/pypi/pyversions/gimme-that
  :target: https://pypi.org/project/gimme-that
  :alt: PyPI - Python Version

.. image:: https://codecov.io/gh/elfjes/gimme-that/branch/master/graph/badge.svg
  :target: https://codecov.io/gh/elfjes/gimme-that

.. image:: https://readthedocs.org/projects/gimme-that/badge/?version=latest
  :target: https://gimme-that.readthedocs.io/en/latest/
  :alt: Read the Docs

Gimme That
===========
A lightweight, simple but extensible dependency injection framework. Read the full documentation
`here <https://gimme-that.readthedocs.io>`_

Getting started
----------------
Install from `PyPI <https://pypi.org/project/gimme-that>`_

.. code-block::

    pip install gimme-that

Basic usage
#############

.. code-block:: python

    import gimme


    class MyService:
        pass


    class ServiceConsumer:
        def __init__(self, service: MyService):
            self.service = service


    # gimme.that automatically detects and resolves dependencies based on type annotations
    consumer = gimme.that(ServiceConsumer)

    isinstance(consumer.service, MyService)  # True

Features
--------
* Automatically detects dependencies based on type annotations
* Works with ``dataclass`` classes and ``attr.s``
* Class repository that stores created objects for re-use
* Register classes to provide additional configuration on how ``gimme.that`` should instantiate classes

  * Custom factory functions
  * Store or do not store created objects
  * Provide additional keyword arguments to the initializer

* Scoped repositories to manage the lifetime of created objects (useful for testing)
* Does not require any decorators or other additions to your classes (most of the time). They remain `your` classes
* Detects circular dependencies, and provides the means to resolve them
* Extensibility using plugins: create your own logic for resolving dependencies and instantiating classes

Development
------------
.. code-block::

    pip install -e .[dev]



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/elfjes/gimme-that",
    "name": "gimme-that",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "inversion-of-control IoC DI dependency-injection",
    "author": "Pelle Koster",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/27/c2/73fdf90901ba4fb5f042a200e730ae094f48ca982240149b0fc8559afe45/gimme-that-0.3.1.tar.gz",
    "platform": null,
    "description": ".. image:: https://github.com/elfjes/gimme-that/actions/workflows/main.yml/badge.svg?branch=master\n  :target: https://github.com/elfjes/gimme-that/actions/workflows/main.yml\n  :alt: Github Actions\n\n.. image:: https://badge.fury.io/py/gimme-that.svg\n  :target: https://pypi.org/project/gimme-that\n  :alt: PyPI - Package version\n\n.. image:: https://img.shields.io/pypi/pyversions/gimme-that\n  :target: https://pypi.org/project/gimme-that\n  :alt: PyPI - Python Version\n\n.. image:: https://codecov.io/gh/elfjes/gimme-that/branch/master/graph/badge.svg\n  :target: https://codecov.io/gh/elfjes/gimme-that\n\n.. image:: https://readthedocs.org/projects/gimme-that/badge/?version=latest\n  :target: https://gimme-that.readthedocs.io/en/latest/\n  :alt: Read the Docs\n\nGimme That\n===========\nA lightweight, simple but extensible dependency injection framework. Read the full documentation\n`here <https://gimme-that.readthedocs.io>`_\n\nGetting started\n----------------\nInstall from `PyPI <https://pypi.org/project/gimme-that>`_\n\n.. code-block::\n\n    pip install gimme-that\n\nBasic usage\n#############\n\n.. code-block:: python\n\n    import gimme\n\n\n    class MyService:\n        pass\n\n\n    class ServiceConsumer:\n        def __init__(self, service: MyService):\n            self.service = service\n\n\n    # gimme.that automatically detects and resolves dependencies based on type annotations\n    consumer = gimme.that(ServiceConsumer)\n\n    isinstance(consumer.service, MyService)  # True\n\nFeatures\n--------\n* Automatically detects dependencies based on type annotations\n* Works with ``dataclass`` classes and ``attr.s``\n* Class repository that stores created objects for re-use\n* Register classes to provide additional configuration on how ``gimme.that`` should instantiate classes\n\n  * Custom factory functions\n  * Store or do not store created objects\n  * Provide additional keyword arguments to the initializer\n\n* Scoped repositories to manage the lifetime of created objects (useful for testing)\n* Does not require any decorators or other additions to your classes (most of the time). They remain `your` classes\n* Detects circular dependencies, and provides the means to resolve them\n* Extensibility using plugins: create your own logic for resolving dependencies and instantiating classes\n\nDevelopment\n------------\n.. code-block::\n\n    pip install -e .[dev]\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Simple and flexible dependency injection framework.",
    "version": "0.3.1",
    "split_keywords": [
        "inversion-of-control",
        "ioc",
        "di",
        "dependency-injection"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b9648430fc6d24fde977268fa63f5cad139a0facbb435d75fba961470fd3d6f9",
                "md5": "19f8fce9ff84710d03efcdb09807a58a",
                "sha256": "3abf4ac9cf145714b25363aa3b387af696f771951cdbefd4f86953a4c5d38ff4"
            },
            "downloads": -1,
            "filename": "gimme_that-0.3.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "19f8fce9ff84710d03efcdb09807a58a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 11951,
            "upload_time": "2023-01-19T18:08:32",
            "upload_time_iso_8601": "2023-01-19T18:08:32.897690Z",
            "url": "https://files.pythonhosted.org/packages/b9/64/8430fc6d24fde977268fa63f5cad139a0facbb435d75fba961470fd3d6f9/gimme_that-0.3.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "27c273fdf90901ba4fb5f042a200e730ae094f48ca982240149b0fc8559afe45",
                "md5": "12dfc9691544266b44072cf57e720561",
                "sha256": "143d4551c65f625abbb9c55995a521fec68d6a34b561516919e293c8c40d72f1"
            },
            "downloads": -1,
            "filename": "gimme-that-0.3.1.tar.gz",
            "has_sig": false,
            "md5_digest": "12dfc9691544266b44072cf57e720561",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 11749,
            "upload_time": "2023-01-19T18:08:34",
            "upload_time_iso_8601": "2023-01-19T18:08:34.020801Z",
            "url": "https://files.pythonhosted.org/packages/27/c2/73fdf90901ba4fb5f042a200e730ae094f48ca982240149b0fc8559afe45/gimme-that-0.3.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-19 18:08:34",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "elfjes",
    "github_project": "gimme-that",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "gimme-that"
}
        
Elapsed time: 0.46602s