Metadata-Version: 2.1
Name: services-registry
Version: 0.0.1
Summary: A registry for managing services in Python applications
Author-email: Yaroslav Grebnov <grebnov@gmail.com>
License: The MIT License (MIT)
        
        Copyright (c) 2022 Yaroslav Grebnov
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
Project-URL: Homepage, https://github.com/ygrebnov/services-registry
Project-URL: Bug Tracker, https://github.com/ygrebnov/services-registry/issues
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/x-rst
Provides-Extra: test
License-File: LICENSE

=================
services-registry
=================

|python| |version|

.. |version| image:: http://img.shields.io/pypi/v/services-registry.svg
  :target: https://pypi.python.org/pypi/services-registry

.. |python| image:: https://img.shields.io/pypi/pyversions/services-registry.svg
  :target: https://pypi.python.org/pypi/services-registry/

A registry to manage services in a Python application.

Description
===========

* Registry keeps track of all initialized services and returns corresponding services handlers to caller.
* Registry initializes a service if it has not been initialized before being requested.
* Registry makes sure that at any point of time, at most one service registry handler exists.

Usage
=====

1. Services must inherit from the ``services_registry.services_registry.Service`` class. For example:

.. code-block::

    from services_registry.services_registry import Service


    class MyService(Service):
        pass


2. Services registry can be used in code in thr following way:

.. code-block::

    from services_registry.services_registry import services_registry


    my_service = services_registry.get_service(MyService)

License
=======

Distributed under the terms of the `MIT`_ license.

.. _MIT: https://github.com/ygrebnov/services-registry/blob/master/LICENSE
