{ "info": { "author": "Mac Ryan", "author_email": "quasipedia@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Topic :: Documentation", "Topic :: Internet :: WWW/HTTP :: WSGI :: Application", "Topic :: Software Development :: Build Tools", "Topic :: Software Development :: Documentation", "Topic :: Software Development :: Libraries :: Application Frameworks" ], "description": "Swaggery\n========\n\nA python3 framework to code self-documenting RESTful API's according to the\n[swagger](https://swagger.io) specifications.\n\nThe project currently support swagger specifications 1.2, migration to version\n2.0 is underway.\n\nServing the application via uWSGI is a **temporary requirement** as this is\npresently the only WSGI server to provide support for the `yeld from` syntax.\n\nAs soon as [native support for `asyncio` will become stable]\n(http://uwsgi-docs.readthedocs.org/en/latest/asyncio.html), Swaggery will be\nrefactored to use that (hopefully universal, and thus supported by other WSGI\nservers) mechanism.\n\n\n\nDesign principles\n-----------------\n\n - **Lightweight** - Swaggery is not built on top of web application\n frameworks designed to serve websites. It is built ground-up for serving\n swagger APIs. The only core dependency is [werkzeug]\n (http://werkzeug.pocoo.org/).\n - **Consistent** - Swaggery has born from the observation that in large\n corporate environments (but in poorly managed small projects too!) APIs\n tend to become inconsistent over time: as various endpoints are implemented\n by various people, the naming conventions, data containers and/or types\n multiply, making the API more difficult to use and buggy than it ought to\n be. Swaggery tries to mitigate this phenomenon by using classes with a\n well defined interface that self-document themselves in a consistent\n manner.\n - **Concurrent** - Swaggery has been designed from day #1 to be concurrent.\n Concurrency is not an afterthought achieved with a hack, it has been the\n first stone to be laid down at the beginning of the project.\n - **Testable** - The uniform interface of Swaggery endpoints, that have no\n side effects makes unit-testing very easy to do.\n - **Modern** - The upside of Swaggery being a new project that doesn't build\n onto large, multi-purpose frameworks (read: flask, django, etc...) is that\n it was possible to use modern python to build it. In particular,\n Swaggery heavily relies on the `yeld from syntax` introduced in Python 3.3\n and function annotations, introduced in Python 3.0. As soon as this will\n be supported by at least one of the major WSGI servers, Swaggery will\n be modified (read: simplified!) to run on the `asyncio` loop (introduced\n in python 3.4).\n\n\nQuick Start\n-----------\n\nAfter having installed the dependencies in the virtual environment, you will\nhave to create your own `swaggery.ini` file.\n\nA template can be found at `/templates/swaggery.ini`. After you have done,\njust type:\n\n uwsgi swaggery.ini\n\n\n\nCreating your own API\n---------------------\n\nSwaggery APIs are created by subclassing 3 main \"abstract\" classes:\n\n### Model ###\n\nModels define the data strcutures used by the API. Since Swaggery is based on\nJSON-schema, the native data types are readily available in the `models.py`\nmodule (where the abstract `Model` class also lives).\n\nModels are referenced in the Endpoint method signatures, so they need to be\ndeclared (or imported) before defining any Endpoint, as they will be avaluated\nat import time.\n\nModel classes have a single class attribute called \"schema\" which must conform\nto JSON schema syntax (see: [here](http://json-schema.org/) and\n[here](https://github.com/wordnik/swagger-core/wiki/datatypes)).\n\n\n### Api ###\n\nAPIs are just lightweight containers grouping related resources. Since they do\nnot perform any particular type of operation, their declaration is\nstraighforward:\n\n class ZombieManipulation(Api):\n\n '''A beautiful API allowing to manipulate zombies.'''\n\n version = '1.0.0'\n path = 'zombies'\n\n\n### Resources ###\n\nResources are \"entities\" that can be manipulated atomically. They are mapped\nto a single, unique URL/endpoint. And the manipulation happens via HTTP verbs.\nThe URL can be either _static_ (`/zombies`) or _dynamic_ (`/zombies/{id}`),\nwere the `{id}` part means the ID value is a variable supplied by the client.\n\nOperations on the entities are performed by calling the endpoint with the\nappropriate HTTP method/verb. For example you might issue a `GET` on\n`/zombies/666` and the server might return the strength, stamina, and max\nvelocity of the zombie #666. Alternatively you might `POST` to the same URL,\nadding either a form or a body to the request, with the strength, stamina and\nmax velocity of a zombie to be newly created.\n\nBack to Swaggery...\n\nA Resoruce is implemented by subclassing the `Resource` class. Operations are\nimplented as class methods, decorated with the `operations` function.\n\nClass methods need to be fully annotated, and have a docstring, to make\npossible for Swaggery to instrospect them correctly. For example:\n\n class AddVectors(Resource):\n\n '''Single vector operations.'''\n\n api = Calculator\n subpath = 'vector'\n\n @operations('POST')\n def length(\n cls, request,\n vector: (Ptypes.body,\n Vector('The vector to analyse.'))) -> [\n (200, 'Ok', Float),\n (400, 'Wrong vector format')]:\n '''Return the modulo of a vector.'''\n \n\nWill be rendered as the following swagger description:\n\n {\n \"description\": \"Single vector operations.\", \n \"operations\": [\n {\n \"method\": \"POST\", \n \"nickname\": \"length\", \n \"notes\": \"\", \n \"parameters\": [\n {\n \"type\": \"Vector\",\n \"description\": \"The vector to analyse.\", \n \"name\": \"vector\", \n \"paramType\": \"body\", \n \"required\": true\n }\n ], \n \"responseMessages\": [\n {\n \"code\": 200, \n \"message\": \"Ok\", \n \"responseModel\": \"float\"\n }, \n {\n \"code\": 400, \n \"message\": \"Wrong vector format\", \n \"responseModel\": \"void\"\n }\n ], \n \"summary\": \"Return the modulo of a vector.\", \n \"type\": \"float\"\n }\n ], \n \"path\": \"/calc/vector\"\n }\n\nSee the full example int the `examples/calculator` folder.\n\n\n\nStuff that needs to be documented\n---------------------------------\n\n - Use sphinx\n - Return mechanism (Fail vs. return)\n - How testing is easy\n - Only one callback for each HTTP (REST)\n - Request is passed as a courtesy, but shouldn't be used for business logic\n - Ptypes\n - Streaming answers\n - swaggery.ini file\n - testlib\n - Subpath\n - Checker\n\n\n\nFAQ\n---\n\n\n### Where is the Python 2.X compatible version? ###\n\nSupport for python 2.x series **cannot** be provided as the library heavily\nrelies on function annotation, which has been introduced in python 3.0 as well\nas from the `yield from` syntax introduced in v 3.3.", "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/quasipedia/swaggery", "keywords": "swagger API documentation asyncronous framework uWSGI WSGI", "license": "AGPLv3+", "maintainer": null, "maintainer_email": null, "name": "swaggery", "package_url": "https://pypi.org/project/swaggery/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/swaggery/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/quasipedia/swaggery" }, "release_url": "https://pypi.org/project/swaggery/1.0.0a1/", "requires_dist": null, "requires_python": null, "summary": "A Python3 framework to create self-documenting swagger APIs", "version": "1.0.0a1" }, "last_serial": 1273235, "releases": { "1.0.0a1": [ { "comment_text": "", "digests": { "md5": "3f922fef11c78f2cb0b9061580874ea3", "sha256": "12953b5eb2e8b1b1e372efd00fca8533b5df48cab1dfdfc907755622a9f031f2" }, "downloads": -1, "filename": "swaggery-1.0.0a1-py3-none-any.whl", "has_sig": false, "md5_digest": "3f922fef11c78f2cb0b9061580874ea3", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 49251, "upload_time": "2014-10-16T23:54:07", "url": "https://files.pythonhosted.org/packages/c1/1c/368146f253ebf228d4fb8dd76e9cd37eda3bdf1fe1d0fb48e972ce7e0215/swaggery-1.0.0a1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0eafc1a6f03648df01b5bdeee4992f6e", "sha256": "6b7d58e44b1a21f7592dbdfcf927c6dce515d1e7d09897374df855497c4a2d77" }, "downloads": -1, "filename": "swaggery-1.0.0a1.tar.gz", "has_sig": false, "md5_digest": "0eafc1a6f03648df01b5bdeee4992f6e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 32929, "upload_time": "2014-10-16T23:54:11", "url": "https://files.pythonhosted.org/packages/77/ce/40d9fbf8e1a039f6b267d8cd76c913ea3a919c88f65f8b2fe81b3b2c44d9/swaggery-1.0.0a1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3f922fef11c78f2cb0b9061580874ea3", "sha256": "12953b5eb2e8b1b1e372efd00fca8533b5df48cab1dfdfc907755622a9f031f2" }, "downloads": -1, "filename": "swaggery-1.0.0a1-py3-none-any.whl", "has_sig": false, "md5_digest": "3f922fef11c78f2cb0b9061580874ea3", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 49251, "upload_time": "2014-10-16T23:54:07", "url": "https://files.pythonhosted.org/packages/c1/1c/368146f253ebf228d4fb8dd76e9cd37eda3bdf1fe1d0fb48e972ce7e0215/swaggery-1.0.0a1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0eafc1a6f03648df01b5bdeee4992f6e", "sha256": "6b7d58e44b1a21f7592dbdfcf927c6dce515d1e7d09897374df855497c4a2d77" }, "downloads": -1, "filename": "swaggery-1.0.0a1.tar.gz", "has_sig": false, "md5_digest": "0eafc1a6f03648df01b5bdeee4992f6e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 32929, "upload_time": "2014-10-16T23:54:11", "url": "https://files.pythonhosted.org/packages/77/ce/40d9fbf8e1a039f6b267d8cd76c913ea3a919c88f65f8b2fe81b3b2c44d9/swaggery-1.0.0a1.tar.gz" } ] }