{ "info": { "author": "Jos\u00e9 Antonio Perdiguero L\u00f3pez", "author_email": "perdy@perdy.io", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "

\n Flama\n

\n

\n 🔥 Fire up your API with this flamethrower.\n

\n

\n\n \"Build\n\n\n \"Coverage\"\n\n\n \"Package\n\n

\n\n---\n\n**Documentation**: [https://flama.perdy.io](https://flama.perdy.io)\n\n---\n\n# Flama\n\nFlama aims to bring a layer on top of [Starlette] to provide an **easy to learn** and **fast to develop** approach for \nbuilding **highly performant** GraphQL and REST APIs. In the same way of Starlette is, Flama is a perfect option for \ndeveloping **asynchronous** and **production-ready** services. \n\nAmong other characteristics it provides the following:\n\n* **Generic classes** for API resources that provides standard CRUD methods over SQLAlchemy tables.\n* **Schema system** based on [Marshmallow] that allows to **declare** the inputs and outputs of endpoints and provides \na reliable way of **validate** data against those schemas.\n* **Dependency Injection** that ease the process of managing parameters needed in endpoints. Flama ASGI objects \nlike `Request`, `Response`, `Session` and so on are defined as components and ready to be injected in your endpoints.\n* **Components** as the base of the plugin ecosystem, allowing you to create custom or use those already defined in \nyour endpoints, injected as parameters.\n* **Auto generated API schema** using OpenAPI standard. It uses the schema system of your endpoints to extract all the \nnecessary information to generate your API Schema.\n* **Auto generated docs** providing a [Swagger UI] or [ReDoc] endpoint.\n* **Pagination** automatically handled using multiple methods such as limit and offset, page numbers...\n\n## Requirements\n\n* [Python] 3.6+\n* [Starlette] 0.12.0+\n* [Marshmallow] 3.0.0+\n\n## Installation\n\n```console\n$ pip install flama\n```\n\n## Example\n\n```python\nfrom marshmallow import Schema, fields, validate\nfrom flama.applications import Flama\nimport uvicorn\n\n# Data Schema\nclass Puppy(Schema):\n id = fields.Integer()\n name = fields.String()\n age = fields.Integer(validate=validate.Range(min=0))\n\n\n# Database\npuppies = [\n {\"id\": 1, \"name\": \"Canna\", \"age\": 6},\n {\"id\": 2, \"name\": \"Sandy\", \"age\": 12},\n]\n\n\n# Application\napp = Flama(\n components=[], # Without custom components\n title=\"Foo\", # API title\n version=\"0.1\", # API version\n description=\"Bar\", # API description\n schema=\"/schema/\", # Path to expose OpenAPI schema\n docs=\"/docs/\", # Path to expose Swagger UI docs\n redoc=\"/redoc/\", # Path to expose ReDoc docs\n)\n\n\n# Views\n@app.route(\"/\", methods=[\"GET\"])\ndef list_puppies(name: str = None) -> Puppy(many=True):\n \"\"\"\n description:\n List the puppies collection. There is an optional query parameter that \n specifies a name for filtering the collection based on it.\n responses:\n 200:\n description: List puppies.\n \"\"\"\n return [puppy for puppy in puppies if puppy[\"name\"] == name]\n \n\n@app.route(\"/\", methods=[\"POST\"])\ndef create_puppy(puppy: Puppy) -> Puppy:\n \"\"\"\n description:\n Create a new puppy using data validated from request body and add it \n to the collection.\n responses:\n 200:\n description: Puppy created successfully.\n \"\"\"\n puppies.append(puppy)\n \n return puppy\n\n\nif __name__ == '__main__':\n uvicorn.run(app, host='0.0.0.0', port=8000)\n```\n\n## Dependencies\n\nFollowing Starlette philosophy Flama reduce the number of hard dependencies to those that are used as the core:\n\n* [`starlette`][Starlette] - Flama is a layer on top of it.\n* [`marshmallow`][Marshmallow] - Flama data schemas and validation.\n\nIt does not have any more hard dependencies, but some of them are necessaries to use some features:\n\n* [`pyyaml`][pyyaml] - Required for API Schema and Docs auto generation.\n* [`apispec`][apispec] - Required for API Schema and Docs auto generation.\n* [`python-forge`][python-forge] - Required for pagination.\n* [`sqlalchemy`][SQLAlchemy] - Required for Generic API resources.\n* [`databases`][databases] - Required for Generic API resources.\n\nYou can install all of these with `pip3 install flama[full]`.\n\n## Credits\n\nThat library is heavily inspired by [APIStar] server in an attempt to bring a good amount of it essence to work with \n[Starlette] as the ASGI framework and [Marshmallow] as the schema system.\n\n## Contributing\n\nThis project is absolutely open to contributions so if you have a nice idea, create an issue to let the community \ndiscuss it.\n\n[Python]: https://www.python.org\n[Starlette]: https://starlette.io\n[APIStar]: https://github.com/encode/apistar/tree/version-0.5.x\n[Marshmallow]: https://marshmallow.readthedocs.io/\n[Swagger UI]: https://swagger.io/tools/swagger-ui/\n[ReDoc]: https://rebilly.github.io/ReDoc/\n[pyyaml]: https://pyyaml.org/wiki/PyYAMLDocumentation\n[apispec]: https://apispec.readthedocs.io/\n[python-forge]: https://python-forge.readthedocs.io/\n[SQLAlchemy]: https://www.sqlalchemy.org/\n[databases]: https://github.com/encode/databases\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/PeRDy/flama", "keywords": "starlette,api,apistar,components,schema", "license": "GPL-3.0+", "maintainer": "Jos\u00e9 Antonio Perdiguero L\u00f3pez", "maintainer_email": "perdy@perdy.io", "name": "flama", "package_url": "https://pypi.org/project/flama/", "platform": "", "project_url": "https://pypi.org/project/flama/", "project_urls": { "Homepage": "https://github.com/PeRDy/flama", "Repository": "https://github.com/PeRDy/flama" }, "release_url": "https://pypi.org/project/flama/0.10.0/", "requires_dist": [ "starlette (>=0.12.0,<0.13.0)", "marshmallow (>=3.0,<4.0)", "python-forge (>=18.6,<19.0); extra == \"full\" or extra == \"pagination\"", "apispec (>=1.0,<2.0); extra == \"full\" or extra == \"schema\"", "pyyaml (>=3.13,<4.0); extra == \"full\" or extra == \"schema\"", "databases (>=0.2.0,<0.3.0); extra == \"full\" or extra == \"resources\"" ], "requires_python": ">=3.6,<4.0", "summary": "Fire up your API with this flamethrower", "version": "0.10.0" }, "last_serial": 5731549, "releases": { "0.10.0": [ { "comment_text": "", "digests": { "md5": "f7486b61e1d5a5f71ef6e6f29864f147", "sha256": "6bec8f7820e9e966ab31d26ae333f32aa65770c72fca499c2ae05046c159c6ca" }, "downloads": -1, "filename": "flama-0.10.0-py3-none-any.whl", "has_sig": false, "md5_digest": "f7486b61e1d5a5f71ef6e6f29864f147", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6,<4.0", "size": 46083, "upload_time": "2019-08-26T15:22:42", "url": "https://files.pythonhosted.org/packages/04/e3/d1b9119d07a3ebfc95ca2fa59bd54a957e3ac85c6848cb65837714c5c9db/flama-0.10.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ccdaa3caef65506630b999b85caf2e6f", "sha256": "0b26a51f3d4bf614c5e3f4d34e0291d934e1150d4d252f0408fafbc1ddf17419" }, "downloads": -1, "filename": "flama-0.10.0.tar.gz", "has_sig": false, "md5_digest": "ccdaa3caef65506630b999b85caf2e6f", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6,<4.0", "size": 39106, "upload_time": "2019-08-26T15:22:44", "url": "https://files.pythonhosted.org/packages/55/75/59d22fb1fa2755ca3fab4006412333f6aaf93eb8819776c32333d9bf98f8/flama-0.10.0.tar.gz" } ], "0.8.0": [ { "comment_text": "", "digests": { "md5": "b66544ef1aa8ced2773531c2a27061ec", "sha256": "adfe23c20aa27c60aa38ced9831122d69e692c354a753952e99f518b0a6b8c6e" }, "downloads": -1, "filename": "flama-0.8.0-py3-none-any.whl", "has_sig": false, "md5_digest": "b66544ef1aa8ced2773531c2a27061ec", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6,<4.0", "size": 133914, "upload_time": "2019-04-25T17:39:39", "url": "https://files.pythonhosted.org/packages/24/46/d6b5dc5951b645a9eeefe1543d3ad1f59662257c2b61b01dcf7da86ffb10/flama-0.8.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c02b79ae6c0c95c02d54f25dfcd2559d", "sha256": "8187cef2d5c9abd90a386fe768446a3cb8843c8979ee5c36f8cae20200b521a8" }, "downloads": -1, "filename": "flama-0.8.0.tar.gz", "has_sig": false, "md5_digest": "c02b79ae6c0c95c02d54f25dfcd2559d", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6,<4.0", "size": 38354, "upload_time": "2019-04-25T17:39:49", "url": "https://files.pythonhosted.org/packages/d6/b8/1bf2e3ee51c29b4c98ec0d9b65bcb8c991b098b52b97978d12eab10aec88/flama-0.8.0.tar.gz" } ], "0.8.1": [ { "comment_text": "", "digests": { "md5": "2f26185aac100bca25e9cbd50da34ba4", "sha256": "8546b947e261606e8fc6ae0a9dc3e2f345a947236253ef726220d8e7970c0426" }, "downloads": -1, "filename": "flama-0.8.1-py3-none-any.whl", "has_sig": false, "md5_digest": "2f26185aac100bca25e9cbd50da34ba4", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6,<4.0", "size": 134077, "upload_time": "2019-05-13T15:01:08", "url": "https://files.pythonhosted.org/packages/49/f8/e23f905071a18acc3fd6f215e5e28b026e162f42cc383a713aa2be52a76b/flama-0.8.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "20a9a7f245fa9e598e0c9d491c88c5f6", "sha256": "77935154a9465809093a57b239cacc16f2e05afe3f7045fd1d1b040578e845e3" }, "downloads": -1, "filename": "flama-0.8.1.tar.gz", "has_sig": false, "md5_digest": "20a9a7f245fa9e598e0c9d491c88c5f6", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6,<4.0", "size": 38451, "upload_time": "2019-05-13T15:01:09", "url": "https://files.pythonhosted.org/packages/f9/bb/ab391cb00d4fd5c31913b1a3f0521d208adacdbcc9cf4b78d36acba6f5ef/flama-0.8.1.tar.gz" } ], "0.8.2": [ { "comment_text": "", "digests": { "md5": "3972bee221fb6c24a9fb5aec4fe93bb0", "sha256": "ba25ec9b1f8d49b39e0f772c6e7c2eaed1b11c9bbb9d4c9f05d9c4261c62ed22" }, "downloads": -1, "filename": "flama-0.8.2-py3-none-any.whl", "has_sig": false, "md5_digest": "3972bee221fb6c24a9fb5aec4fe93bb0", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6,<4.0", "size": 134073, "upload_time": "2019-05-13T15:08:15", "url": "https://files.pythonhosted.org/packages/9d/1f/893fafaf3b62f6665e343a35dceaa5c835836c91638c8a774c10f9e0b7a8/flama-0.8.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a65cfa04d687d0218949af902dceb4dc", "sha256": "d11133001e02121c470e53d3c8285c3a6c494c88ca75b57376fb5fe881c7cee2" }, "downloads": -1, "filename": "flama-0.8.2.tar.gz", "has_sig": false, "md5_digest": "a65cfa04d687d0218949af902dceb4dc", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6,<4.0", "size": 38434, "upload_time": "2019-05-13T15:08:16", "url": "https://files.pythonhosted.org/packages/4d/00/4aa18dd41b8ef7f72712687b1cfd0c2333f8bb56b5c44fff7fd1981afbda/flama-0.8.2.tar.gz" } ], "0.9.0": [ { "comment_text": "", "digests": { "md5": "aa43f39fc35953840c90bbc2540768d0", "sha256": "64468d38c831fcf0d9af2598a28a8bf2f165465cc00330a116b14e00b083c634" }, "downloads": -1, "filename": "flama-0.9.0-py3-none-any.whl", "has_sig": false, "md5_digest": "aa43f39fc35953840c90bbc2540768d0", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6,<4.0", "size": 133178, "upload_time": "2019-06-03T16:19:42", "url": "https://files.pythonhosted.org/packages/3a/15/8e2a6ef137d1d1898321a2f76a05b88e90255a2a2abcd58de25937a33d99/flama-0.9.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b10ec0103df75fffd93cade8ff14b998", "sha256": "1a4df1e2aa4867404a225916f494b692a54e323712c85a22ed122b006bb1875e" }, "downloads": -1, "filename": "flama-0.9.0.tar.gz", "has_sig": false, "md5_digest": "b10ec0103df75fffd93cade8ff14b998", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6,<4.0", "size": 38311, "upload_time": "2019-06-03T16:19:43", "url": "https://files.pythonhosted.org/packages/e5/49/63c18c2b28dae0210e31f2aa4e3503211b075ab7f612ea13753fc362fcfd/flama-0.9.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f7486b61e1d5a5f71ef6e6f29864f147", "sha256": "6bec8f7820e9e966ab31d26ae333f32aa65770c72fca499c2ae05046c159c6ca" }, "downloads": -1, "filename": "flama-0.10.0-py3-none-any.whl", "has_sig": false, "md5_digest": "f7486b61e1d5a5f71ef6e6f29864f147", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6,<4.0", "size": 46083, "upload_time": "2019-08-26T15:22:42", "url": "https://files.pythonhosted.org/packages/04/e3/d1b9119d07a3ebfc95ca2fa59bd54a957e3ac85c6848cb65837714c5c9db/flama-0.10.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ccdaa3caef65506630b999b85caf2e6f", "sha256": "0b26a51f3d4bf614c5e3f4d34e0291d934e1150d4d252f0408fafbc1ddf17419" }, "downloads": -1, "filename": "flama-0.10.0.tar.gz", "has_sig": false, "md5_digest": "ccdaa3caef65506630b999b85caf2e6f", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6,<4.0", "size": 39106, "upload_time": "2019-08-26T15:22:44", "url": "https://files.pythonhosted.org/packages/55/75/59d22fb1fa2755ca3fab4006412333f6aaf93eb8819776c32333d9bf98f8/flama-0.10.0.tar.gz" } ] }