{ "info": { "author": "Colton Allen", "author_email": "colton.allen@caxiam.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "## Flask Compose\n\nA simple router that promotes component driven endpoint design.\n\n#### Installation\n\n```bash\n$ pip install flask-compose\n```\n\n#### Getting Started\n\nPlease explore the \"examples\" directory for more detailed samples.\n\n`flask-compose` can be applied to any `flask` application without consideration for any existing routing libraries. `flask-compose`, at its core, is a glorified call to `Flask.add_url_rule`.\n\nCreating a route is as simple as defining a few types:\n\n```python\nfrom flask import Flask\nfrom flask_router import Component, Handler, Include, Route, Router\n\n\n# Handler\nclass MyHandler(Handler): ...\n\n\n# Components\nclass UserComponent(Component): ...\nclass SQLAlchemyComponent(Component): ...\n\n\n# Controllers\ndef browse_type(handler, **uri_args): ...\ndef get_type(handler, **uri_args): ...\n\n\n# Routes\nroute = Include(\n '/users', routes=[\n Route('', controller=browse_type, handler=MyHandler, components=[UserComponent]),\n Route('/', controller=get_type, handler=MyHandler, components=[UserComponent]),\n ], components=[SQLAlchemyComponent])\n\n\napp = Flask(__name__)\napi = Router(app)\napi.add_routes([route])\n```\n\nYou're done! The above code can be thought to evaluate to:\n\n```python\n# For browse type controllers.\ndef dispatch_request(**uri_args):\n handler = SQLAlchemyComponent(UserComponent(MyHandler()))\n return browse_type(handler, **uri_args)\n```\n\n#### Why\n\nREST resources have well known behaviors that rarely deviate on a per resource basis. Knowing this, resources should lend themselves to reuse. However, as often happens in glue code, there is just enough variability between resources that reuse is either impossible or impractical. The \"Decorator Design Pattern\" was concieved as an attempt to address this type of problem. This library encourages its use through its routing system.\n\n#### Philosophy\n\nThis library encourages the use of the \"Decorator Design Pattern\". Not to be confused with Python's decorators, the \"Decorator Design Pattern\" is an object-oriented approach to annotating behavior. The naming of these two concepts is not coincidental. Python's decorators describe on a function-based level what the \"Decorator Design Pattern\" describes on an object-based level.\n\n#### Credits\n\nWith thanks to the molten framework, flask, and \"The Gang of Four\" for their contributions to the software world. Without whom this project would not have been possible.\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/cmanallen/flask_router", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "flask-compose", "package_url": "https://pypi.org/project/flask-compose/", "platform": "", "project_url": "https://pypi.org/project/flask-compose/", "project_urls": { "Homepage": "https://github.com/cmanallen/flask_router" }, "release_url": "https://pypi.org/project/flask-compose/0.2.0/", "requires_dist": [ "flask" ], "requires_python": "", "summary": "A routing library for flask applications obeying the \"Decorator Design Pattern\".", "version": "0.2.0" }, "last_serial": 4422209, "releases": { "0.2.0": [ { "comment_text": "", "digests": { "md5": "7e48a8b0b35ace7248648a3db5e5c57a", "sha256": "a194f61a58954806d6786acc27d8f218dd3666ada12de305da6ec8369e6b2c62" }, "downloads": -1, "filename": "flask_compose-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "7e48a8b0b35ace7248648a3db5e5c57a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7920, "upload_time": "2018-10-27T15:16:04", "url": "https://files.pythonhosted.org/packages/c1/8c/e41666e03404ccc0b7da9463c9efd677f5f99cac61b50194d8efb1bb9c73/flask_compose-0.2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8add2d30d4d51fe87680681b9330a6e4", "sha256": "56a469de5c6bd9059b097ccd461e55165f19dca95c14067e51c09b1d30d6e59c" }, "downloads": -1, "filename": "flask_compose-0.2.0.tar.gz", "has_sig": false, "md5_digest": "8add2d30d4d51fe87680681b9330a6e4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5586, "upload_time": "2018-10-27T15:16:06", "url": "https://files.pythonhosted.org/packages/7f/53/66ff431ff14777a149f3955a6626e9083b4ced5d80bb549f7a2b84d905e9/flask_compose-0.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7e48a8b0b35ace7248648a3db5e5c57a", "sha256": "a194f61a58954806d6786acc27d8f218dd3666ada12de305da6ec8369e6b2c62" }, "downloads": -1, "filename": "flask_compose-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "7e48a8b0b35ace7248648a3db5e5c57a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7920, "upload_time": "2018-10-27T15:16:04", "url": "https://files.pythonhosted.org/packages/c1/8c/e41666e03404ccc0b7da9463c9efd677f5f99cac61b50194d8efb1bb9c73/flask_compose-0.2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8add2d30d4d51fe87680681b9330a6e4", "sha256": "56a469de5c6bd9059b097ccd461e55165f19dca95c14067e51c09b1d30d6e59c" }, "downloads": -1, "filename": "flask_compose-0.2.0.tar.gz", "has_sig": false, "md5_digest": "8add2d30d4d51fe87680681b9330a6e4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5586, "upload_time": "2018-10-27T15:16:06", "url": "https://files.pythonhosted.org/packages/7f/53/66ff431ff14777a149f3955a6626e9083b4ced5d80bb549f7a2b84d905e9/flask_compose-0.2.0.tar.gz" } ] }