Metadata-Version: 2.1
Name: buvar-aiohttp
Version: 0.4.3
Summary: Asyncio plugin for buvar
Home-page: https://gitlab.com/diefans/buvar
Author: Oliver Berger
Author-email: diefans@gmail.com
License: UNKNOWN
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Framework :: AsyncIO
Classifier: License :: OSI Approved :: Apache Software License
Classifier: License :: OSI Approved :: MIT License
Requires-Python: >=3.7,<4.0
Description-Content-Type: text/x-rst
Requires-Dist: buvar (>=0.42.3)
Requires-Dist: aiohttp
Requires-Dist: attrs (>=19.1)
Requires-Dist: structlog
Requires-Dist: pendulum
Requires-Dist: uritools
Provides-Extra: all
Requires-Dist: pytest (>=4.6) ; extra == 'all'
Requires-Dist: pytest-cov (<3.0,>=^2.7) ; extra == 'all'
Requires-Dist: pytest-asyncio (>=0.11.0) ; extra == 'all'
Requires-Dist: pytest-benchmark (>=3.2.2<4.0) ; extra == 'all'
Requires-Dist: mock (>=3.0<4.0) ; extra == 'all'
Requires-Dist: pytest-mock (>=1.10<2.0) ; extra == 'all'
Requires-Dist: pytest-watch (>=4.2<5.0) ; extra == 'all'
Requires-Dist: pytest-randomly (>=3.1<4.0) ; extra == 'all'
Requires-Dist: pytest-doctestplus (>=0.5<1.0) ; extra == 'all'
Requires-Dist: pytest-aiohttp ; extra == 'all'
Requires-Dist: pytest-anything ; extra == 'all'
Requires-Dist: pdbpp ; extra == 'all'
Provides-Extra: tests
Requires-Dist: pytest (>=4.6) ; extra == 'tests'
Requires-Dist: pytest-cov (<3.0,>=^2.7) ; extra == 'tests'
Requires-Dist: pytest-asyncio (>=0.11.0) ; extra == 'tests'
Requires-Dist: pytest-benchmark (>=3.2.2<4.0) ; extra == 'tests'
Requires-Dist: mock (>=3.0<4.0) ; extra == 'tests'
Requires-Dist: pytest-mock (>=1.10<2.0) ; extra == 'tests'
Requires-Dist: pytest-watch (>=4.2<5.0) ; extra == 'tests'
Requires-Dist: pytest-randomly (>=3.1<4.0) ; extra == 'tests'
Requires-Dist: pytest-doctestplus (>=0.5<1.0) ; extra == 'tests'
Requires-Dist: pytest-aiohttp ; extra == 'tests'
Requires-Dist: pytest-anything ; extra == 'tests'
Requires-Dist: pdbpp ; extra == 'tests'

buvar_aiohttp
=============

Solves some boilerplate around starting an `aiohttp`_ server.

.. code-block:: python

    import aiohttp.web
    from buvar import context, di, fork, plugin

    from buvar_aiohttp import AioHttpConfig


    async def hello(request):
        return aiohttp.web.Response(body=b"Hello, world")


    async def prepare_aiohttp(load: plugin.Loader):
        # provide config
        context.add(AioHttpConfig(host="0.0.0.0", port=5678))

        # prepare server site
        await load("buvar_aiohttp")

        # mount routes
        app = await di.nject(aiohttp.web.Application)
        app.router.add_route("GET", "/", hello)


    # start a process for each available CPU and provide a shared socket to all
    # children
    fork.stage(prepare_aiohttp, forks=0, sockets=["tcp://:5678"])


.. _aiohttp: https://docs.aiohttp.org


