======
rororo
======
.. image:: https://github.com/playpauseandstop/rororo/actions/workflows/ci.yml/badge.svg
:target: https://github.com/playpauseandstop/rororo/actions/workflows/ci.yml
:alt: CI Workflow
.. image:: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white
:target: https://github.com/pre-commit/pre-commit
:alt: pre-commit
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/psf/black
:alt: black
.. image:: https://img.shields.io/pypi/v/rororo.svg
:target: https://pypi.org/project/rororo/
:alt: Latest Version
.. image:: https://img.shields.io/pypi/pyversions/rororo.svg
:target: https://pypi.org/project/rororo/
:alt: Python versions
.. image:: https://img.shields.io/pypi/l/rororo.svg
:target: https://github.com/playpauseandstop/rororo/blob/main/LICENSE
:alt: BSD License
.. image:: https://coveralls.io/repos/playpauseandstop/rororo/badge.svg?branch=main&service=github
:target: https://coveralls.io/github/playpauseandstop/rororo
:alt: Coverage
.. image:: https://readthedocs.org/projects/rororo/badge/?version=latest
:target: https://rororo.readthedocs.io/
:alt: Documentation
Implement `aiohttp.web`_ `OpenAPI 3`_ server applications with schema first
approach.
As well as bunch other utilities to build effective server applications with
`Python`_ 3 & `aiohttp.web`_.
* Works on `Python`_ 3.8+
* Works with `aiohttp.web`_ 3.8.1+
* BSD licensed
* Source, issues, and pull requests `on GitHub
<https://github.com/playpauseandstop/rororo>`_
.. _`OpenAPI 3`: https://spec.openapis.org/oas/v3.0.3
.. _`aiohttp.web`: https://docs.aiohttp.org/en/stable/web.html
.. _`Python`: https://www.python.org/
Quick Start
===========
*rororo* relies on valid OpenAPI 3 schema file (both JSON or YAML formats
supported).
Example below, illustrates on how to handle operation ``hello_world`` from
`openapi.yaml`_ schema file.
.. code-block:: python
from pathlib import Path
from aiohttp import web
from rororo import (
openapi_context,
OperationTableDef,
setup_openapi,
)
operations = OperationTableDef()
@operations.register
async def hello_world(request: web.Request) -> web.Response:
with openapi_context(request) as context:
name = context.parameters.query.get("name", "world")
email = context.parameters.query.get(
"email", "world@example.com"
)
return web.json_response(
{"message": f"Hello, {name}!", "email": email}
)
def create_app(argv: list[str] = None) -> web.Application:
return setup_openapi(
web.Application(),
Path(__file__).parent / "openapi.yaml",
operations,
server_url="/api",
)
.. _`openapi.yaml`: https://github.com/playpauseandstop/rororo/blob/main/tests/rororo/openapi.yaml
Schema First Approach
---------------------
Unlike other popular Python OpenAPI 3 solutions, such as
`Django REST Framework`_, `FastAPI`_, `flask-apispec`_, or `aiohttp-apispec`_
*rororo* **requires** you to provide valid `OpenAPI 3`_ schema first. This
makes *rororo* similar to `connexion`_, `pyramid_openapi3`_ and other schema
first libraries.
.. _`Django REST Framework`: https://www.django-rest-framework.org
.. _`FastAPI`: https://fastapi.tiangolo.com
.. _`flask-apispec`: https://flask-apispec.readthedocs.io
.. _`aiohttp-apispec`: https://aiohttp-apispec.readthedocs.io
.. _`connexion`: https://connexion.readthedocs.io
.. _`pyramid_openapi3`: https://github.com/Pylons/pyramid_openapi3
Class Based Views
-----------------
*rororo* supports `class based views`_ as well. `Todo-Backend`_ example
illustrates how to use class based views for OpenAPI 3 servers.
In snippet below, *rororo* expects that OpenAPI 3 schema contains operation ID
``UserView.get``,
.. code-block:: python
@operations.register
class UserView(web.View):
async def get(self) -> web.Response: ...
.. _`class based views`: https://docs.aiohttp.org/en/stable/web_quickstart.html#aiohttp-web-class-based-views
.. _`Todo-Backend`: https://github.com/playpauseandstop/rororo/tree/main/examples/todobackend
More Examples
-------------
Check `examples`_ folder to see other examples on how to build aiohttp.web
OpenAPI 3 server applications.
.. _`examples`: https://github.com/playpauseandstop/rororo/tree/main/examples
Raw data
{
"_id": null,
"home_page": "https://igordavydenko.com/projects/#rororo",
"name": "rororo",
"maintainer": null,
"docs_url": "https://pythonhosted.org/rororo/",
"requires_python": "<4.0,>=3.8",
"maintainer_email": null,
"keywords": "aiohttp, aiohttp.web, oas, openapi, openapi schema, openapi3, schema first",
"author": "Igor Davydenko",
"author_email": "iam@igordavydenko.com",
"download_url": "https://files.pythonhosted.org/packages/15/15/96a21472eb72e4429dc22548055067ea2fa24b4a71240af6b2b1424834d9/rororo-3.3.0.tar.gz",
"platform": null,
"description": "======\nrororo\n======\n\n.. image:: https://github.com/playpauseandstop/rororo/actions/workflows/ci.yml/badge.svg\n :target: https://github.com/playpauseandstop/rororo/actions/workflows/ci.yml\n :alt: CI Workflow\n\n.. image:: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white\n :target: https://github.com/pre-commit/pre-commit\n :alt: pre-commit\n\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg\n :target: https://github.com/psf/black\n :alt: black\n\n.. image:: https://img.shields.io/pypi/v/rororo.svg\n :target: https://pypi.org/project/rororo/\n :alt: Latest Version\n\n.. image:: https://img.shields.io/pypi/pyversions/rororo.svg\n :target: https://pypi.org/project/rororo/\n :alt: Python versions\n\n.. image:: https://img.shields.io/pypi/l/rororo.svg\n :target: https://github.com/playpauseandstop/rororo/blob/main/LICENSE\n :alt: BSD License\n\n.. image:: https://coveralls.io/repos/playpauseandstop/rororo/badge.svg?branch=main&service=github\n :target: https://coveralls.io/github/playpauseandstop/rororo\n :alt: Coverage\n\n.. image:: https://readthedocs.org/projects/rororo/badge/?version=latest\n :target: https://rororo.readthedocs.io/\n :alt: Documentation\n\nImplement `aiohttp.web`_ `OpenAPI 3`_ server applications with schema first\napproach.\n\nAs well as bunch other utilities to build effective server applications with\n`Python`_ 3 & `aiohttp.web`_.\n\n* Works on `Python`_ 3.8+\n* Works with `aiohttp.web`_ 3.8.1+\n* BSD licensed\n* Source, issues, and pull requests `on GitHub\n <https://github.com/playpauseandstop/rororo>`_\n\n.. _`OpenAPI 3`: https://spec.openapis.org/oas/v3.0.3\n.. _`aiohttp.web`: https://docs.aiohttp.org/en/stable/web.html\n.. _`Python`: https://www.python.org/\n\nQuick Start\n===========\n\n*rororo* relies on valid OpenAPI 3 schema file (both JSON or YAML formats\nsupported).\n\nExample below, illustrates on how to handle operation ``hello_world`` from\n`openapi.yaml`_ schema file.\n\n.. code-block:: python\n\n from pathlib import Path\n\n from aiohttp import web\n from rororo import (\n openapi_context,\n OperationTableDef,\n setup_openapi,\n )\n\n\n operations = OperationTableDef()\n\n\n @operations.register\n async def hello_world(request: web.Request) -> web.Response:\n with openapi_context(request) as context:\n name = context.parameters.query.get(\"name\", \"world\")\n email = context.parameters.query.get(\n \"email\", \"world@example.com\"\n )\n return web.json_response(\n {\"message\": f\"Hello, {name}!\", \"email\": email}\n )\n\n\n def create_app(argv: list[str] = None) -> web.Application:\n return setup_openapi(\n web.Application(),\n Path(__file__).parent / \"openapi.yaml\",\n operations,\n server_url=\"/api\",\n )\n\n.. _`openapi.yaml`: https://github.com/playpauseandstop/rororo/blob/main/tests/rororo/openapi.yaml\n\nSchema First Approach\n---------------------\n\nUnlike other popular Python OpenAPI 3 solutions, such as\n`Django REST Framework`_, `FastAPI`_, `flask-apispec`_, or `aiohttp-apispec`_\n*rororo* **requires** you to provide valid `OpenAPI 3`_ schema first. This\nmakes *rororo* similar to `connexion`_, `pyramid_openapi3`_ and other schema\nfirst libraries.\n\n.. _`Django REST Framework`: https://www.django-rest-framework.org\n.. _`FastAPI`: https://fastapi.tiangolo.com\n.. _`flask-apispec`: https://flask-apispec.readthedocs.io\n.. _`aiohttp-apispec`: https://aiohttp-apispec.readthedocs.io\n.. _`connexion`: https://connexion.readthedocs.io\n.. _`pyramid_openapi3`: https://github.com/Pylons/pyramid_openapi3\n\nClass Based Views\n-----------------\n\n*rororo* supports `class based views`_ as well. `Todo-Backend`_ example\nillustrates how to use class based views for OpenAPI 3 servers.\n\nIn snippet below, *rororo* expects that OpenAPI 3 schema contains operation ID\n``UserView.get``,\n\n.. code-block:: python\n\n @operations.register\n class UserView(web.View):\n async def get(self) -> web.Response: ...\n\n\n.. _`class based views`: https://docs.aiohttp.org/en/stable/web_quickstart.html#aiohttp-web-class-based-views\n.. _`Todo-Backend`: https://github.com/playpauseandstop/rororo/tree/main/examples/todobackend\n\nMore Examples\n-------------\n\nCheck `examples`_ folder to see other examples on how to build aiohttp.web\nOpenAPI 3 server applications.\n\n.. _`examples`: https://github.com/playpauseandstop/rororo/tree/main/examples\n\n",
"bugtrack_url": null,
"license": "BSD-3-Clause",
"summary": "aiohttp.web OpenAPI 3 schema first server applications.",
"version": "3.3.0",
"project_urls": {
"Bug Tracker": "https://github.com/playpauseandstop/rororo/issues",
"Documentation": "https://rororo.readthedocs.io/",
"Homepage": "https://igordavydenko.com/projects/#rororo",
"Repository": "https://github.com/playpauseandstop/rororo"
},
"split_keywords": [
"aiohttp",
" aiohttp.web",
" oas",
" openapi",
" openapi schema",
" openapi3",
" schema first"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8c30ac7213550d57195c5a23eb08e77c4631de23ac399f3bb66893a82d2e4a28",
"md5": "bd9558431dfd15558ef6fe2093c7bad0",
"sha256": "94e75d08decf89b44944696aa55ab6037a7c0e9788537dcf506510b698ad5572"
},
"downloads": -1,
"filename": "rororo-3.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "bd9558431dfd15558ef6fe2093c7bad0",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.8",
"size": 43820,
"upload_time": "2024-08-16T19:25:20",
"upload_time_iso_8601": "2024-08-16T19:25:20.013140Z",
"url": "https://files.pythonhosted.org/packages/8c/30/ac7213550d57195c5a23eb08e77c4631de23ac399f3bb66893a82d2e4a28/rororo-3.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "151596a21472eb72e4429dc22548055067ea2fa24b4a71240af6b2b1424834d9",
"md5": "4f7d625a2e32c59eae9680bd4e0e6465",
"sha256": "5e322dbbde30453989251471f4e37e12e407bb5b6bf0f23c32741bc5a657d54c"
},
"downloads": -1,
"filename": "rororo-3.3.0.tar.gz",
"has_sig": false,
"md5_digest": "4f7d625a2e32c59eae9680bd4e0e6465",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.8",
"size": 38390,
"upload_time": "2024-08-16T19:25:21",
"upload_time_iso_8601": "2024-08-16T19:25:21.407342Z",
"url": "https://files.pythonhosted.org/packages/15/15/96a21472eb72e4429dc22548055067ea2fa24b4a71240af6b2b1424834d9/rororo-3.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-16 19:25:21",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "playpauseandstop",
"github_project": "rororo",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "rororo"
}