{ "info": { "author": "Igor Quintanilha", "author_email": "igormq@poli.ufrj.br", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": ".. image:: https://travis-ci.org/igormq/klass-registry.svg?branch=master\n :target: https://travis-ci.org/igormq/klass-registry\n.. image:: https://readthedocs.org/projects/klass-registry/badge/?version=master\n :target: https://klass-registry.readthedocs.io/\n\n\n=============\nClassRegistry\n=============\n\nAt the intersection of the Registry and Factory patterns lies the\n``ClassRegistry``:\n\n- Define global factories that generate new class instances based on\n configurable keys.\n- Seamlessly create powerful service registries.\n- Integrate with setuptools's ``entry_points`` system to make your registries\n infinitely extensible by 3rd-party libraries!\n- And more!\n\n\nGetting Started\n---------------\n\nCreate a registry using the ``klass_registry.ClassRegistry`` class, then\ndecorate any classes that you wish to register with its ``register`` method:\n\n.. code-block:: python\n\n from klass_registry import ClassRegistry\n\n pokedex = ClassRegistry()\n\n @pokedex.register('fire')\n class Charizard(Pokemon):\n ...\n\n @pokedex.register('grass')\n class Bulbasaur(Pokemon):\n ...\n\n @pokedex.register('water')\n class Squirtle(Pokemon):\n ...\n\nTo create a class instance from a registry, use the subscript operator:\n\n.. code-block:: python\n\n # Charizard, I choose you!\n fighter1 = pokedex['fire']\n\n # CHARIZARD fainted!\n # How come my rival always picks the type that my pok\u00e9mon is weak against??\n fighter2 = pokedex['grass']\n\n\nAdvanced Usage\n~~~~~~~~~~~~~~\n\nThere's a whole lot more you can do with ClassRegistry, including:\n\n- Provide args and kwargs to new class instances.\n- Automatically register non-abstract classes.\n- Integrate with setuptools's ``entry_points`` system so that 3rd-party\n libraries can add their own classes to your registries.\n- Wrap your registry in an instance cache to create a service registry.\n- And more!\n\nFor more advanced usage, check out the documentation on `ReadTheDocs`_!\n\n\nRequirements\n------------\n\nClassRegistry is compatible with Python versions 3.7, 3.6, 3.5 and 2.7.\n\n\nInstallation\n------------\n\nInstall the latest stable version via pip::\n\n pip install klass-registry\n\n\nRunning Unit Tests\n------------------\nTo run unit tests after installing from source::\n\n python setup.py test\n\nThis project is also compatible with `tox`_, which will run the unit tests in\ndifferent virtual environments (one for each supported version of Python).\n\nTo run the unit tests, it is recommended that you use the `detox`_ library.\ndetox speeds up the tests by running them in parallel.\n\nInstall the package with the ``test-runner`` extra to set up the necessary\ndependencies, and then you can run the tests with the ``tox`` command::\n\n pip install -e .[test-runner]\n tox -v\n\n.. tip::\n To run tests for multiple Python versions in parallel::\n\n # Python 3.7 only\n tox -p all\n\n # Python 3.6 or earlier\n pip install detox\n detox\n\nDocumentation\n-------------\nDocumentation is available on `ReadTheDocs`_.\n\nIf you are installing from source (see above), you can also build the\ndocumentation locally:\n\n#. Install extra dependencies (you only have to do this once)::\n\n pip install '.[docs-builder]'\n\n#. Switch to the ``docs`` directory::\n\n cd docs\n\n#. Build the documentation::\n\n make html\n\n\n.. _ReadTheDocs: https://klass-registry.readthedocs.io/\n.. _detox: https://pypi.python.org/pypi/detox\n.. _tox: https://tox.readthedocs.io/\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://klass-registry.readthedocs.io/", "keywords": "registry pattern", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "klass-registry", "package_url": "https://pypi.org/project/klass-registry/", "platform": "", "project_url": "https://pypi.org/project/klass-registry/", "project_urls": { "Homepage": "https://klass-registry.readthedocs.io/" }, "release_url": "https://pypi.org/project/klass-registry/2.2.2/", "requires_dist": [ "six", "typing ; python_version < \"3.0\"", "sphinx ; extra == 'docs-builder'", "sphinx-rtd-theme ; extra == 'docs-builder'", "detox ; extra == 'test-runner'" ], "requires_python": "", "summary": "Factory+Registry pattern for Python classes.", "version": "2.2.2" }, "last_serial": 5178453, "releases": { "2.2.2": [ { "comment_text": "", "digests": { "md5": "5daece33b60f09c4720a9ff1426ce4b7", "sha256": "0e60278235bffcc26f60ab4d0560cc48e5cc7be6c55e6d4559f60e4773d2d52b" }, "downloads": -1, "filename": "klass_registry-2.2.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "5daece33b60f09c4720a9ff1426ce4b7", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 12252, "upload_time": "2019-04-23T17:17:31", "url": "https://files.pythonhosted.org/packages/e3/5b/9fdda3ebbb592e54c947613fd50a422fbb32e7fef7ae1062d35270e906a9/klass_registry-2.2.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e211690ff314c437b6377e0ea6984559", "sha256": "45749c3f914ccd76a2fe2cad18c87958e6d7b20e1fcfdc2c93ec8ac348ee4137" }, "downloads": -1, "filename": "klass-registry-2.2.2.tar.gz", "has_sig": false, "md5_digest": "e211690ff314c437b6377e0ea6984559", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16431, "upload_time": "2019-04-23T17:17:33", "url": "https://files.pythonhosted.org/packages/b5/e0/629c5fb71b434941a442267b1b6728a4c0eeb444390721b2ffd1c7c6d187/klass-registry-2.2.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5daece33b60f09c4720a9ff1426ce4b7", "sha256": "0e60278235bffcc26f60ab4d0560cc48e5cc7be6c55e6d4559f60e4773d2d52b" }, "downloads": -1, "filename": "klass_registry-2.2.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "5daece33b60f09c4720a9ff1426ce4b7", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 12252, "upload_time": "2019-04-23T17:17:31", "url": "https://files.pythonhosted.org/packages/e3/5b/9fdda3ebbb592e54c947613fd50a422fbb32e7fef7ae1062d35270e906a9/klass_registry-2.2.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e211690ff314c437b6377e0ea6984559", "sha256": "45749c3f914ccd76a2fe2cad18c87958e6d7b20e1fcfdc2c93ec8ac348ee4137" }, "downloads": -1, "filename": "klass-registry-2.2.2.tar.gz", "has_sig": false, "md5_digest": "e211690ff314c437b6377e0ea6984559", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16431, "upload_time": "2019-04-23T17:17:33", "url": "https://files.pythonhosted.org/packages/b5/e0/629c5fb71b434941a442267b1b6728a4c0eeb444390721b2ffd1c7c6d187/klass-registry-2.2.2.tar.gz" } ] }