{ "info": { "author": "David Betz", "author_email": "dfb@davidbetz.net", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.6", "Topic :: Software Development :: Build Tools" ], "description": "Abstract Factory for Python\n===========================\n\nCopyright (c) 2016-2017 David Betz\n\n|Build Status| |PyPI version|\n\nSee test\\_provider.py unit test for usage.\n\nBasically an implementation of an abstract factory pattern.\n\nIn one system where I use this, I create factories for eachs type of\nthing in my system. So, SearchFactory, CloudStorageFactory,\nQueueFactory, AristotleFactory, etc... These would implement for ID\ninterface like ICloudStorageProvider (in Node, it's just a class).\n\nEach of these would have their own switch/case (or whatever) to create\nthe factory for it. So, for example, I may have config in a YAML file\nspecifying that I want to use Mongo for my Aristotle provider\n(\"Aristotle\" is what most people incorrectly call \"NoSQL\").\n\nTo begin, create the factory (do this one for the entirety of your\nsystem):\n\n::\n\n abstractFactory = AbstractFactory()\n\nThen, add your factories:\n\n::\n\n abstractFactory.set(SearchFactory)\n abstractFactory.set(CloudStorageFactory)\n abstractFactory.set(QueueFactory)\n abstractFactory.set(AristotleFactory)\n\nWhen the time comes, just ask for your provider:\n\n::\n\n provider = abstractFactory.resolve(IAristotleProvider)\n\nYour code SHOULD. NOT. CARE. ABOUT. MONGO. It should the your\nconfiguration or something handle that. Don't tightly couple your\nproviders.\n\nAlso note that the resolver also accepts various arguments for extra\nflexibility:\n\n::\n\n provider = abstractFactory.resolve(IAristotleProvider, \"alternateConnectionString\", collection=\"log\") \n\nDespite what random bloggers say, service locators are awesome and\nprovide excellent decoupling.\n\nLook at the ``Mock`` examples provided with the tests; they're rather\nextensive.\n\n.. |Build Status| image:: https://travis-ci.org/davidbetz/pyabstractfactory.svg?branch=master\n :target: https://travis-ci.org/davidbetz/pyabstractfactory\n.. |PyPI version| image:: https://badge.fury.io/py/abstractfactory.svg\n :target: https://badge.fury.io/py/abstractfactory", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/davidbetz/pyabstractfactory", "keywords": "abstract-factory,patterns", "license": "", "maintainer": "", "maintainer_email": "", "name": "abstractfactory", "package_url": "https://pypi.org/project/abstractfactory/", "platform": "", "project_url": "https://pypi.org/project/abstractfactory/", "project_urls": { "Homepage": "https://github.com/davidbetz/pyabstractfactory" }, "release_url": "https://pypi.org/project/abstractfactory/1.0.3/", "requires_dist": null, "requires_python": "", "summary": "Abstract Factory functionality for Python", "version": "1.0.3" }, "last_serial": 3030187, "releases": { "1.0.1": [ { "comment_text": "", "digests": { "md5": "4a8545f5337e85dc56e67569eb2502ab", "sha256": "92b5e51d4577942976f7410479d01b56cc1dcdc89ac70d20b2c42b5ce16cb9ac" }, "downloads": -1, "filename": "abstractfactory-1.0.1.tar.gz", "has_sig": false, "md5_digest": "4a8545f5337e85dc56e67569eb2502ab", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4388, "upload_time": "2017-07-15T14:43:47", "url": "https://files.pythonhosted.org/packages/08/db/3c90172325d1bd4c28a30eb87610e08ff1167b919f68d60b7e4c7ff0bbf4/abstractfactory-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "30a179b0ec59350f7d33d5996707d8b4", "sha256": "c68b0f6e68286d56708b9614d6d2efcb70cdf558f5b7b59718fde44f5440d7f3" }, "downloads": -1, "filename": "abstractfactory-1.0.2.tar.gz", "has_sig": false, "md5_digest": "30a179b0ec59350f7d33d5996707d8b4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4483, "upload_time": "2017-07-15T20:17:26", "url": "https://files.pythonhosted.org/packages/3d/eb/180625b60024a0a623d40fe43b7574e7d4ffe49c70f7e868cd40be71aca2/abstractfactory-1.0.2.tar.gz" } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "a52931683ffb1046841fcd5997b217fa", "sha256": "712eb72e138994a1de406c16c3574ed5dc6447f1b2e61236be63b7ea134ebefe" }, "downloads": -1, "filename": "abstractfactory-1.0.3.tar.gz", "has_sig": false, "md5_digest": "a52931683ffb1046841fcd5997b217fa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4486, "upload_time": "2017-07-18T01:59:10", "url": "https://files.pythonhosted.org/packages/fd/02/b9b4328ff23342300c9ce11ccbd82a98ce4b90ded760914395817e67ba32/abstractfactory-1.0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a52931683ffb1046841fcd5997b217fa", "sha256": "712eb72e138994a1de406c16c3574ed5dc6447f1b2e61236be63b7ea134ebefe" }, "downloads": -1, "filename": "abstractfactory-1.0.3.tar.gz", "has_sig": false, "md5_digest": "a52931683ffb1046841fcd5997b217fa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4486, "upload_time": "2017-07-18T01:59:10", "url": "https://files.pythonhosted.org/packages/fd/02/b9b4328ff23342300c9ce11ccbd82a98ce4b90ded760914395817e67ba32/abstractfactory-1.0.3.tar.gz" } ] }