rsgiadapter


Namersgiadapter JSON
Version 0.0.6 PyPI version JSON
download
home_pageNone
SummaryAn adapter for asgi to rsgi
upload_time2024-06-15 09:00:08
maintainerNone
docs_urlNone
authorNone
requires_python<4.0,>=3.8
licenseBSD-3-Clause
keywords asgi rsgi adapter asgi adapter rsgi adapter asgi to rsgi rsgi to asgi asyncio
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # rsgiadapter

[![PyPI - Version](https://img.shields.io/pypi/v/rsgiadapter?style=for-the-badge)](https://pypi.org/project/rsgiadapter/) ![GitHub License](https://img.shields.io/github/license/belingud/rsgiadapter?style=for-the-badge) ![PyPI - Downloads](https://img.shields.io/pypi/dm/rsgiadapter?logo=pypi&cacheSeconds=86400&style=for-the-badge) ![PyPI - Status](https://img.shields.io/pypi/status/rsgiadapter?style=for-the-badge)

An Asgi to rsgi adapter.

RSGI Specification ref: https://github.com/emmett-framework/granian/blob/master/docs/spec/RSGI.md

`rsgiadapter` is an adapter for [RSGI](https://github.com/emmett-framework/granian/blob/master/docs/spec/RSGI.md) server run [ASGI](https://asgi.readthedocs.io) application like FastAPI and BlackSheep.

Usage:

`app.py`
```python
import granian
from granian.constants import Interfaces
from rsgiadapter import ASGIToRSGI

app = None  # Define your asgi application here

rsgi_app = ASGIToRSGI(app)

serve = granian.Granian("app:rsgi_app", interface=Interfaces.RSGI)
serve.serve()
```

with asgi lifespan:

```python
from contextlib import asynccontextmanager

import granian
from granian.constants import Interfaces
from rsgiadapter import ASGIToRSGI


@asynccontextmanager
async def lifespan(_app):
    print("lifespan start")
    yield
    print("lifespan stop")


app = None  # Define your asgi application here

rsgi_app = ASGIToRSGI(app, lifespan=lifespan)

serve = granian.Granian("app:rsgi_app", interface=Interfaces.RSGI)
serve.serve()
```

Supported Feature:

- [x] HTTP Request Response
  - [x] ASGI scope
  - [x] ASGI receive
  - [x] ASGI send
- [x] Extensions
  - [x] http.response.pathsend
  - [ ] websocket.http.response
  - [ ] http.response.push
  - [ ] http.response.zerocopysend
  - [ ] http.response.early_hint
  - [ ] http.response.trailers
  - [ ] http.response.debug
- [x] Lifespan
  - [x] lifespan.startup
  - [x] lifespan.startup.complete(silence)
  - [x] lifespan.startup.failed(will terminate)
  - [x] lifespan.shutdown
  - [x] lifespan.shutdown.complete(silence)
  - [x] lifespan.shutdown.failed(will terminate)

Ref:

- Granian: https://github.com/emmett-framework/granian

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "rsgiadapter",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": null,
    "keywords": "asgi, rsgi, adapter, asgi adapter, rsgi adapter, asgi to rsgi, rsgi to asgi, asyncio",
    "author": null,
    "author_email": "belingud <im.victor@qq.com>",
    "download_url": "https://files.pythonhosted.org/packages/b7/7a/f9843c5cb73517e78f1b3e6ad3d532100cdb9e2fa7cfe42722e636a88b4f/rsgiadapter-0.0.6.tar.gz",
    "platform": null,
    "description": "# rsgiadapter\n\n[![PyPI - Version](https://img.shields.io/pypi/v/rsgiadapter?style=for-the-badge)](https://pypi.org/project/rsgiadapter/) ![GitHub License](https://img.shields.io/github/license/belingud/rsgiadapter?style=for-the-badge) ![PyPI - Downloads](https://img.shields.io/pypi/dm/rsgiadapter?logo=pypi&cacheSeconds=86400&style=for-the-badge) ![PyPI - Status](https://img.shields.io/pypi/status/rsgiadapter?style=for-the-badge)\n\nAn Asgi to rsgi adapter.\n\nRSGI Specification ref: https://github.com/emmett-framework/granian/blob/master/docs/spec/RSGI.md\n\n`rsgiadapter` is an adapter for [RSGI](https://github.com/emmett-framework/granian/blob/master/docs/spec/RSGI.md) server run [ASGI](https://asgi.readthedocs.io) application like FastAPI and BlackSheep.\n\nUsage:\n\n`app.py`\n```python\nimport granian\nfrom granian.constants import Interfaces\nfrom rsgiadapter import ASGIToRSGI\n\napp = None  # Define your asgi application here\n\nrsgi_app = ASGIToRSGI(app)\n\nserve = granian.Granian(\"app:rsgi_app\", interface=Interfaces.RSGI)\nserve.serve()\n```\n\nwith asgi lifespan:\n\n```python\nfrom contextlib import asynccontextmanager\n\nimport granian\nfrom granian.constants import Interfaces\nfrom rsgiadapter import ASGIToRSGI\n\n\n@asynccontextmanager\nasync def lifespan(_app):\n    print(\"lifespan start\")\n    yield\n    print(\"lifespan stop\")\n\n\napp = None  # Define your asgi application here\n\nrsgi_app = ASGIToRSGI(app, lifespan=lifespan)\n\nserve = granian.Granian(\"app:rsgi_app\", interface=Interfaces.RSGI)\nserve.serve()\n```\n\nSupported Feature:\n\n- [x] HTTP Request Response\n  - [x] ASGI scope\n  - [x] ASGI receive\n  - [x] ASGI send\n- [x] Extensions\n  - [x] http.response.pathsend\n  - [ ] websocket.http.response\n  - [ ] http.response.push\n  - [ ] http.response.zerocopysend\n  - [ ] http.response.early_hint\n  - [ ] http.response.trailers\n  - [ ] http.response.debug\n- [x] Lifespan\n  - [x] lifespan.startup\n  - [x] lifespan.startup.complete(silence)\n  - [x] lifespan.startup.failed(will terminate)\n  - [x] lifespan.shutdown\n  - [x] lifespan.shutdown.complete(silence)\n  - [x] lifespan.shutdown.failed(will terminate)\n\nRef:\n\n- Granian: https://github.com/emmett-framework/granian\n",
    "bugtrack_url": null,
    "license": "BSD-3-Clause",
    "summary": "An adapter for asgi to rsgi",
    "version": "0.0.6",
    "project_urls": {
        "Homepage": "https://github.com/belingud/rsgiadapter"
    },
    "split_keywords": [
        "asgi",
        " rsgi",
        " adapter",
        " asgi adapter",
        " rsgi adapter",
        " asgi to rsgi",
        " rsgi to asgi",
        " asyncio"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "83f100368790a631fd90df35d47a08f00477c010a0f64613614e7bef16fa4f9f",
                "md5": "158a77e8d2255138dda6c1e4550228d0",
                "sha256": "84ece32389d3863621c991b2a4d7b1886111aa284cd75335c77c50f3c9da7633"
            },
            "downloads": -1,
            "filename": "rsgiadapter-0.0.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "158a77e8d2255138dda6c1e4550228d0",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 9701,
            "upload_time": "2024-06-15T09:00:05",
            "upload_time_iso_8601": "2024-06-15T09:00:05.637079Z",
            "url": "https://files.pythonhosted.org/packages/83/f1/00368790a631fd90df35d47a08f00477c010a0f64613614e7bef16fa4f9f/rsgiadapter-0.0.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b77af9843c5cb73517e78f1b3e6ad3d532100cdb9e2fa7cfe42722e636a88b4f",
                "md5": "9bffa6d5e0e64d5e007183017948aa00",
                "sha256": "57c895b6b8d5ee6724fb874c9bdaeec872559b78094895e214b149466a760cda"
            },
            "downloads": -1,
            "filename": "rsgiadapter-0.0.6.tar.gz",
            "has_sig": false,
            "md5_digest": "9bffa6d5e0e64d5e007183017948aa00",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 10681,
            "upload_time": "2024-06-15T09:00:08",
            "upload_time_iso_8601": "2024-06-15T09:00:08.468096Z",
            "url": "https://files.pythonhosted.org/packages/b7/7a/f9843c5cb73517e78f1b3e6ad3d532100cdb9e2fa7cfe42722e636a88b4f/rsgiadapter-0.0.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-15 09:00:08",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "belingud",
    "github_project": "rsgiadapter",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "rsgiadapter"
}
        
Elapsed time: 0.25802s