rororo


Namerororo JSON
Version 3.2.0 PyPI version JSON
download
home_pagehttps://igordavydenko.com/projects/#rororo
Summaryaiohttp.web OpenAPI 3 schema first server applications.
upload_time2023-05-29 20:33:26
maintainer
docs_urlhttps://pythonhosted.org/rororo/
authorIgor Davydenko
requires_python>=3.7,<4.0
licenseBSD-3-Clause
keywords aiohttp aiohttp.web oas openapi openapi schema openapi3 schema first
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ======
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.7+
* 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 typing import List

    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": "",
    "docs_url": "https://pythonhosted.org/rororo/",
    "requires_python": ">=3.7,<4.0",
    "maintainer_email": "",
    "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/8a/ee/94fee4a4fc7b56daae796b280f8e08b7bee6bd361bc9e0f4d7c54dada1e9/rororo-3.2.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.7+\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    from typing import List\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\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.2.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": "7f37560bc4411e4e11bd41fc79c1c713a2eaad520865632b3311f549e80a156b",
                "md5": "7af711b38827b6c265867fe7828918d2",
                "sha256": "768cf846b7ebe1db32290794871cc389d803a7bab66fedcce22073b3bdc938b9"
            },
            "downloads": -1,
            "filename": "rororo-3.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7af711b38827b6c265867fe7828918d2",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7,<4.0",
            "size": 43810,
            "upload_time": "2023-05-29T20:33:25",
            "upload_time_iso_8601": "2023-05-29T20:33:25.165830Z",
            "url": "https://files.pythonhosted.org/packages/7f/37/560bc4411e4e11bd41fc79c1c713a2eaad520865632b3311f549e80a156b/rororo-3.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8aee94fee4a4fc7b56daae796b280f8e08b7bee6bd361bc9e0f4d7c54dada1e9",
                "md5": "4bd3f328b2ae67313877271676f8f2c8",
                "sha256": "b94ae7183f6799142368e4b6b78db9de4a8db41f32308f64392b18613105eb8c"
            },
            "downloads": -1,
            "filename": "rororo-3.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "4bd3f328b2ae67313877271676f8f2c8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7,<4.0",
            "size": 38397,
            "upload_time": "2023-05-29T20:33:26",
            "upload_time_iso_8601": "2023-05-29T20:33:26.459592Z",
            "url": "https://files.pythonhosted.org/packages/8a/ee/94fee4a4fc7b56daae796b280f8e08b7bee6bd361bc9e0f4d7c54dada1e9/rororo-3.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-29 20:33:26",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "playpauseandstop",
    "github_project": "rororo",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "rororo"
}
        
Elapsed time: 0.09519s