Metadata-Version: 2.2
Name: asgi-tools
Version: 0.35.1
Summary: Is a toolkit to build ASGI applications faster
Home-page: https://github.com/klen/asgi-tools
Author: Kirill Klenov
Author-email: horneds@gmail.com
License: MIT
Project-URL: Documentation, https://klen.github.io/asgi-tools
Project-URL: Source code, https://github.com/klen/asgi-tools
Project-URL: Issue tracker, https://github.com/klen/asgi-tools/issues
Keywords: asyncio,trio,asgi,asgi tools,request,response
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Framework :: AsyncIO
Classifier: Framework :: Trio
Requires-Python: >=3.7
License-File: LICENSE
Requires-Dist: multidict
Requires-Dist: yarl
Requires-Dist: http-router>=2.0.1
Requires-Dist: sniffio
Requires-Dist: cached_property; python_version < "3.8"
Requires-Dist: typing_extensions; python_version < "3.8"
Provides-Extra: tests
Requires-Dist: aiofile; extra == "tests"
Requires-Dist: anyio; extra == "tests"
Requires-Dist: pytest; extra == "tests"
Requires-Dist: pytest-mypy; extra == "tests"
Requires-Dist: trio; extra == "tests"
Provides-Extra: examples
Requires-Dist: uvicorn; extra == "examples"
Requires-Dist: websockets; extra == "examples"
Requires-Dist: jinja2; extra == "examples"
Requires-Dist: httpx; extra == "examples"
Provides-Extra: build
Requires-Dist: bump2version; extra == "build"
Requires-Dist: twine; extra == "build"
Requires-Dist: wheel; extra == "build"
Requires-Dist: idna<3; extra == "build"
Provides-Extra: docs
Requires-Dist: sphinx; extra == "docs"
Requires-Dist: sphinx-rtd-theme; extra == "docs"

.. image:: https://raw.githubusercontent.com/klen/asgi-tools/develop/.github/assets/asgi-tools.png
   :height: 100

.. _description:

**asgi-tools** -- Is a really lightweight ASGI_ Toolkit to build ASGI applications faster.

.. _badges:

.. image:: https://github.com/klen/asgi-tools/workflows/tests/badge.svg
    :target: https://github.com/klen/asgi-tools/actions
    :alt: Tests Status

.. image:: https://github.com/klen/asgi-tools/workflows/docs/badge.svg
    :target: https://klen.github.io/asgi-tools
    :alt: Documentation Status

.. image:: https://img.shields.io/pypi/v/asgi-tools
    :target: https://pypi.org/project/asgi-tools/
    :alt: PYPI Version

.. image:: https://img.shields.io/pypi/pyversions/asgi-tools
    :target: https://pypi.org/project/asgi-tools/
    :alt: Python Versions

----------

.. _documentation:

**Documentation is here**: https://klen.github.io/asgi-tools

ASGI-Tools is designed to be used as an ASGI Toolkit to quickly build really
lightweight ASGI applications/middlewares/tools.

For instance these middlewares were built with the library:

* `ASGI-Sessions <https://github.com/klen/asgi-sessions>`_
* `ASGI-Babel <https://github.com/klen/asgi-babel>`_

.. _features:

**Features:**

- Supports `Asyncio`_ and `Trio`_ libraries
- `Request`_                 -- Parse ASGI scope, get url, headers, cookies, read a request's data/json/form-data
- `Response`_                -- Send HTTP (text, html, json, stream, file, http errors) responses
- `ResponseWebsocket`_       -- Work with websockets
- `RequestMiddleware`_       -- Parse a scope and insert the parsed request into the scope
- `ResponseMiddleware`_      -- Parse responses and convert them into ASGI messages
- `RouterMiddleware`_        -- Route HTTP requests
- `LifespanMiddleware`_      -- Process a lifespan cycle
- `StaticFilesMiddleware`_   -- Serve static files from URL prefixes
- `asgi_tools.tests.TestClient <https://klen.github.io/asgi-tools/api.html#testclient>`_ -- A test client with websockets support to test asgi applications
- `App`_                     -- A simple foundation for ASGI apps

.. _contents:

.. contents::

.. _requirements:

Requirements
=============

- python >= 3.7

.. _installation:

Installation
=============

**asgi-tools** should be installed using pip: ::

    pip install asgi-tools

A Quick Example
===============

You can use any of ASGI-Tools components independently.

Dispite this ASGI-Tools contains App_ helper to quickly build ASGI
applications. For instance:

Save this to ``app.py``.

.. code-block:: python

    from asgi_tools import App

    app = App()

    @app.route('/')
    async def hello(request):
        return "Hello World!"

Run it with `uvicorn`

.. code-block:: sh

   $ uvicorn app:app


.. _bugtracker:

Bug tracker
===========

If you have any suggestions, bug reports or
annoyances please report them to the issue tracker
at https://github.com/klen/asgi-tools/issues

.. _contributing:

Contributing
============

Development of the project happens at: https://github.com/klen/asgi-tools

.. _license:

License
========

Licensed under a `MIT license`_.


.. _links:

.. _Asyncio: https://docs.python.org/3/library/asyncio.html
.. _Trio: https://trio.readthedocs.io/en/stable/index.html
.. _klen: https://github.com/klen
.. _MIT license: http://opensource.org/licenses/MIT
.. _ASGI: https://asgi.readthedocs.io/en/latest/

.. _Request: https://klen.github.io/asgi-tools/api.html#request
.. _Response: https://klen.github.io/asgi-tools/api.html#responses
.. _ResponseWebSocket: https://klen.github.io/asgi-tools/api.html#responsewebsocket
.. _RequestMiddleware: https://klen.github.io/asgi-tools/api.html#requestmiddleware
.. _ResponseMiddleware: https://klen.github.io/asgi-tools/api.html#responsemiddleware
.. _LifespanMiddleware: https://klen.github.io/asgi-tools/api.html#lifespanmiddleware
.. _StaticFilesMiddleware: https://klen.github.io/asgi-tools/api.html#staticfilesmiddleware
.. _RouterMiddleware: https://klen.github.io/asgi-tools/api.html#routermiddleware
.. _App: https://klen.github.io/asgi-tools/api.html#application
