{ "info": { "author": "Paul Osborne", "author_email": "paul.osborne@etherios.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)", "Operating System :: OS Independent", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Topic :: Software Development :: Libraries", "Topic :: Software Development :: Libraries :: Application Frameworks" ], "description": "|Build Status|\n\nEpoxy\n=====\n\nIntroduction\n------------\n\nEpoxy is an inversion of control framework for Python applications\npackaged with a set of adapters that can be used with a number of\nexisting technologies. Epoxy allows you to clearly separate out the\nconcern of mapping dependencies to components from defining those\ncomponents.\n\nEpoxy is probably overkill for small apps (like the example below) but\nshows its true value on larger projects where a higher degree of\nflexibility and lower degree of coupling is desirable.\n\nLicense\n-------\n\nThis library is available under the terms of the MPL. Please see the\nLICENSE file for details.\n\nAn Example\n----------\n\nHere's an example of an epoxy component:\n\n::\n\n from epoxy.component import Component, Dependency\n\n class PrinterComponent(Component):\n\n prefix = StringSetting(required=False, default=\"PRINTING\")\n\n def print(self, stuff):\n print (\"[%s] %%s\" % self.prefix) % stuff\n\n def start(self):\n print self.print(\"Warming up printer\")\n\n\n class ScreenRenderer(Component):\n\n printer = Dependency()\n\n def render_screen(self):\n self.printer.print(\"My Stuff\")\n\n def start(self):\n self.printer.print(\"Screen Renderer Initialized\")\n\nIn this example, ScreenRenderer does not need to know the precise\nprinter which will be used as a dependency at runtime, it just needs to\ndeclare the dependency and use it (there is an assumed interface, as\nwith much in python we just use duck typing).\n\nTo wire these components up at runtime, we would write a yaml file that\nwould have something like this:\n\n::\n\n components:\n printer:\n class: my.module:PrinterComponent\n settings:\n prefix: PREFIX\n\n screen_renderer:\n class: my.module:ScreenRenderer\n dependencies:\n printer: printer\n\n entry-point:\n screen_renderer:render_screen\n\nFinally, to load in our configuration and run the application, we would\nwrite something like the following:\n\n::\n\n from epoxy.configuration import YamlConfigurationLoader\n from epoxy.core import ComponentManager\n\n loader = YamlConfigurationLoader(\"myapp.yml\")\n config = loader.load_configuration()\n component_mgr = ComponentManager()\n component_mgr.launch_configuration(config)\n\nThis would run our entry point and print the following to the screen:\n\n::\n\n [PREFIX] Warming up printer\n [PREFIX] Screen Renderer Initialized\n [PREFIX] my stuff\n\nWriting a Component\n-------------------\n\nAny Component that is written should follow these basic rules in order\nto play nicely:\n\n1. No-args constructor: Components should have a no-args constructor in\n order to be instantiated by the framework. To initialize a Component\n in your own code (maybe from a unit test) you can use the\n \"from\\_dependencies\" classmethod available on any component and pass\n in any relevant dependencies/settings as keyword arguments.\n\n For instance, instantiating our previous object graph would look like\n the following:\n\n ::\n\n printer = PrinterComponent.from_dependencies(prefix=\"FROM_DEPS\")\n renderer = ScreenRenderer.from_dependencies(printer=printer)\n\n When ``__init__`` is executed it is guaranteed that all dependencies\n will be present and initialized (but not started).\n\n2. Implement ``start()`` method: After all objects in the graph are\n instantiated, they will be started. Like with ``__init__``,\n dependencies will be present and will have had ``start()`` called.\n Calls to ``start()`` should not block. For long-running tasks, using\n an entry-point is more appropriate.\n\n3. Avoid Dependency Cycles: If the object graph has dependencies, you\n will get errors when trying to build the dependency graph and you\n will not be able to run your application. There are many different\n strategies for breaking these cycles. If you run into this issue and\n are ticked off, just know that fixing this issue is making your\n application better.\n\n.. |Build Status| image:: https://travis-ci.org/Etherios/epoxy.svg?branch=master\n :target: https://travis-ci.org/Etherios/epoxy", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/etherios/epoxy", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "epoxy", "package_url": "https://pypi.org/project/epoxy/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/epoxy/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/etherios/epoxy" }, "release_url": "https://pypi.org/project/epoxy/1.0/", "requires_dist": null, "requires_python": null, "summary": "Inversion of Control Framework for Python", "version": "1.0" }, "last_serial": 1996204, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "22e9cada54cba2441588d0a097cf5c8b", "sha256": "a944a903abfe0986e4af9f54a20b75359c717606996ab70851295981fcc07aea" }, "downloads": -1, "filename": "epoxy-1.0.tar.gz", "has_sig": false, "md5_digest": "22e9cada54cba2441588d0a097cf5c8b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14238, "upload_time": "2014-05-23T17:50:24", "url": "https://files.pythonhosted.org/packages/1e/f3/784e55790a631ea182b10e407799a11759a77c34342cd3ca462d824369ea/epoxy-1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "22e9cada54cba2441588d0a097cf5c8b", "sha256": "a944a903abfe0986e4af9f54a20b75359c717606996ab70851295981fcc07aea" }, "downloads": -1, "filename": "epoxy-1.0.tar.gz", "has_sig": false, "md5_digest": "22e9cada54cba2441588d0a097cf5c8b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14238, "upload_time": "2014-05-23T17:50:24", "url": "https://files.pythonhosted.org/packages/1e/f3/784e55790a631ea182b10e407799a11759a77c34342cd3ca462d824369ea/epoxy-1.0.tar.gz" } ] }