Rust ASGI bindings for python.
- Drop and go CLI for replacing transport layer handling
- ASGI compliant protocols allowing direct import and use of python through rust
- Fast
- p99 @ 38x
-
Relieve limits by python in networking applications
-
Safe python threadpooling
-
Uvicorn drops requests & stalls on IO > 7500 concurrent clients
-
Hypercorn drops requests & stalls on IO > 7500 concurrent clients
In both, we must horizontally scale to accomodate these limits in our systems. This is further accompanied by essentially a second layer of IO bound processes, which are evidently unable to maintain highly concurrent environments
Delegation of connection multiplex, stream, and IO processes into Rust, and autoinjection at runtime following standard ASGI protocol.
Tests performed using ali. See docs/ali for methodology.
- app: fastapi
- file: dotest.bit:app
- app: custom
- file: dotest.baz:app
- app: custom
- file: dotest.baz:app
- app: custom
- file: dotest.baz:app
- app: custom
- file: dotest.baz:app
- app: custom
- file: dotest.baz:app
- app: custom
- file: dotest.baz:app
spvn is offered as beta currently, keep in mind it has quirks and some features might be untested. for this reason, we dont recommend it for production use yet. if you find a bug, please submit an issue!
pip install spvn
spvn | |
---|---|
spvn_caller | |
spvn_lifespan |
Roughly in order of priority
-
[✅] Integrate standard import semantics
-
[✅] PyCaller
- [✅] (rust) Async safe integration
- [✅] Abstract (py fn) async / sync handle
- [✅] Caller pool [this will be revised, its too slow]
-
[✅] Standard asgi traits & structs
- [✅] ASGIScope
- [✅] (rust) Async safe integration
- [✅] Conversion from
tower::Body
->dict
- [✅] ASGIVersion
- [✅] ASGIMessage
- [✅] Lifecycle Scope
- [✅] HTTP Lifecycle Scope
- [🚧] Websockets (msg integration)
- [✅] ASGIScope
-
[✅] App listener
-
[✅] App dispatcher
- [✅] Async threadsafe
- [🚧] Lifecycle activation for caller objects (unstable)
-
[🚧] App scheduler
- [✅] Injectable
awaitables
(rust ptr -> python ptr) - [✅] Async threadsafe
- [✅] Delayed py-fn call
- [🚧] Scheduler into py
- [✅] Injectable
-
[🚧] Live reloader
-
[🚧] Websockets
- Use virtualenv / venv
python3.10 -m (venv|virtualenv) env && \
. ./env/bin/activate && \
pip install maturin
- Test bindings by running
maturin develop
- Build CLI
cargo build
- Run CLI
cargo cli serve dotest.foo:app