~amirouche/segfault

38aed16efc4a03adff94b8560338971c3f7fd8da — Amirouche 1 year, 7 months ago 17ecb52 master
add example uvicorn, run with: python -X dev -m uvicorn bobo:app
3 files changed, 70 insertions(+), 1 deletions(-)

A bobo.py
M poetry.lock
M pyproject.toml
A bobo.py => bobo.py +25 -0
@@ 0,0 1,25 @@
from lsm import LSM


db = LSM('db.sqlite')


async def app(scope, receive, send):
    assert scope['type'] == 'http'
    global db
    for (index, (key, value)) in enumerate(db[b'\x00':b'\xFF']):
        pass

    await send({
        'type': 'http.response.start',
        'status': 200,
        'headers': [
            [b'content-type', b'text/plain'],
        ],
    })
    await send({
        'type': 'http.response.body',
        'body': b'Hello, world!',
    })

db.close()

M poetry.lock => poetry.lock +44 -1
@@ 1,4 1,12 @@
[[package]]
name = "click"
version = "7.1.2"
description = "Composable command line interface toolkit"
category = "main"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"

[[package]]
name = "gunicorn"
version = "20.0.4"
description = "WSGI HTTP Server for UNIX"


@@ 13,6 21,14 @@ setproctitle = ["setproctitle"]
tornado = ["tornado (>=0.2)"]

[[package]]
name = "h11"
version = "0.12.0"
description = "A pure-Python, bring-your-own-I/O implementation of HTTP/1.1"
category = "main"
optional = false
python-versions = ">=3.6"

[[package]]
name = "lsm-db"
version = "0.6.4"
description = "Python bindings for the SQLite4 LSM database."


@@ 20,16 36,43 @@ category = "main"
optional = false
python-versions = "*"

[[package]]
name = "uvicorn"
version = "0.13.3"
description = "The lightning-fast ASGI server."
category = "main"
optional = false
python-versions = "*"

[package.dependencies]
click = ">=7.0.0,<8.0.0"
h11 = ">=0.8"

[package.extras]
standard = ["websockets (>=8.0.0,<9.0.0)", "watchgod (>=0.6,<0.7)", "python-dotenv (>=0.13)", "PyYAML (>=5.1)", "httptools (>=0.1.0,<0.2.0)", "uvloop (>=0.14.0)", "colorama (>=0.4)"]

[metadata]
lock-version = "1.1"
python-versions = "^3.8"
content-hash = "d3afd01cb6ccc04d80f4e60878e70033dc4e94194f87905dd956311507555881"
content-hash = "b3f0f974750835845f4525638f9a3f58fb8522bd603447e9fc05cc62b43c8334"

[metadata.files]
click = [
    {file = "click-7.1.2-py2.py3-none-any.whl", hash = "sha256:dacca89f4bfadd5de3d7489b7c8a566eee0d3676333fbb50030263894c38c0dc"},
    {file = "click-7.1.2.tar.gz", hash = "sha256:d2b5255c7c6349bc1bd1e59e08cd12acbbd63ce649f2588755783aa94dfb6b1a"},
]
gunicorn = [
    {file = "gunicorn-20.0.4-py2.py3-none-any.whl", hash = "sha256:cd4a810dd51bf497552cf3f863b575dabd73d6ad6a91075b65936b151cbf4f9c"},
    {file = "gunicorn-20.0.4.tar.gz", hash = "sha256:1904bb2b8a43658807108d59c3f3d56c2b6121a701161de0ddf9ad140073c626"},
]
h11 = [
    {file = "h11-0.12.0-py3-none-any.whl", hash = "sha256:36a3cb8c0a032f56e2da7084577878a035d3b61d104230d4bd49c0c6b555a9c6"},
    {file = "h11-0.12.0.tar.gz", hash = "sha256:47222cb6067e4a307d535814917cd98fd0a57b6788ce715755fa2b6c28b56042"},
]
lsm-db = [
    {file = "lsm-db-0.6.4.tar.gz", hash = "sha256:1a5c76dec2fd2dcc6f34b442bc0495bd0bf09534467f48e90544acd62d9c38bf"},
]
uvicorn = [
    {file = "uvicorn-0.13.3-py3-none-any.whl", hash = "sha256:1079c50a06f6338095b4f203e7861dbff318dde5f22f3a324fc6e94c7654164c"},
    {file = "uvicorn-0.13.3.tar.gz", hash = "sha256:ef1e0bb5f7941c6fe324e06443ddac0331e1632a776175f87891c7bd02694355"},
]

M pyproject.toml => pyproject.toml +1 -0
@@ 8,6 8,7 @@ authors = ["Amirouche <amirouche@hyper.dev>"]
python = "^3.8"
lsm-db = "^0.6.4"
gunicorn = "^20.0.4"
uvicorn = "^0.13.3"

[tool.poetry.dev-dependencies]