Minimalistic web framework
Project description
Rapis - Minimalistic web library based on RSGI
this library was inspired by FastAPI so syntax may be identical
! WARNING: Library in early development, it is NOT READY for production
Key features:
- Easy to use: Syntax was inspired by your favourite framework
- Fast: Built on Granian in native RSGI protocol with MsgSpec support
- Async Only: Supports only work with async requests handling
- Validation: Built-in support of MsgSpec providing first-class Validation Speed
- Functional that actually MATTER: Framework contains Only what you need to build API without unnecessary dependencies
Requirements
- granian: A Rust HTTP server for Python applications
- msgspec: A fast serialization and validation library
Installation
pip install rapis
Example
# main.py
from rapis import AppRouter, Query, WebApp
router = AppRouter()
@router.get("/")
async def root() -> dict:
return {}
@router.get("/echo")
async def parametrized_handler(
data: Query[str] = "default",
) -> str: # for now waiting for /echo?data=str if not given adds "default"
return data
app = WebApp()
app.include_router(router)
Run
granian main:app
Better Example
# routes.py
from msgspec import Struct
from rapis import AppRouter, Query
router = AppRouter()
class Item(Struct):
name: str
@router.get("/queries_with_struct")
async def fetch_item(item: Query[Item]): # no default means required and will expect to receive all fields in query params
return Item(name="query") # automatically parses to {"name": "query"}
@router.post("/echo") # also put, patch
async def fetch_item(item: Item): # will try to read and validate all fields from body
return item
# main.py
from rapis import WebApp
from routes import router
app = WebApp()
app.include_router(router)
Performance
section about speed of library (WIP)
DOCS will be implemented soon
TODO
- Exception handling (includes 500 when validation not passed)
- Benchmarks section
- Request/Response Work model
- Docs
- More availabilities to expand logic (custom routes and other)
- better Query params handle
- change routing from linear to something else (hash maps for static paths, ?? for dynamic paths)
- path patterns logic
- review Middleware logic (it was taked from fastapi)
- websocket support(maybe)
- coverage
- typing support in TY
CONTRIBUTING
see CONTRIBUTING.md
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rapis-0.0.2.tar.gz.
File metadata
- Download URL: rapis-0.0.2.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aaf8356fdb73ea7b8e8829b2b8695357208746d3abf30ef33893664e59131592
|
|
| MD5 |
350752dd4d6384b2411bb820517896b3
|
|
| BLAKE2b-256 |
8c6300a0ad9b0631917ad4d574655333ad00ef4da98d63c897da7dd7a0cd5dfd
|
Provenance
The following attestation bundles were made for rapis-0.0.2.tar.gz:
Publisher:
python-publish.yml on sheptalo/rapis
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rapis-0.0.2.tar.gz -
Subject digest:
aaf8356fdb73ea7b8e8829b2b8695357208746d3abf30ef33893664e59131592 - Sigstore transparency entry: 1439972566
- Sigstore integration time:
-
Permalink:
sheptalo/rapis@f1f48c7800201c21e524d421baa7853ea44af491 -
Branch / Tag:
refs/tags/0.0.2 - Owner: https://github.com/sheptalo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@f1f48c7800201c21e524d421baa7853ea44af491 -
Trigger Event:
release
-
Statement type:
File details
Details for the file rapis-0.0.2-py3-none-any.whl.
File metadata
- Download URL: rapis-0.0.2-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1b98ddf76297263438ff9b2078eb47b675289d964ee62839d5095c5533d3f6a0
|
|
| MD5 |
e3dd6f37a970c7281e1906e9922ba485
|
|
| BLAKE2b-256 |
4def70f0ae111e455dec9447313f06d96b73f825db87572ae143f397be6a377f
|
Provenance
The following attestation bundles were made for rapis-0.0.2-py3-none-any.whl:
Publisher:
python-publish.yml on sheptalo/rapis
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rapis-0.0.2-py3-none-any.whl -
Subject digest:
1b98ddf76297263438ff9b2078eb47b675289d964ee62839d5095c5533d3f6a0 - Sigstore transparency entry: 1439972570
- Sigstore integration time:
-
Permalink:
sheptalo/rapis@f1f48c7800201c21e524d421baa7853ea44af491 -
Branch / Tag:
refs/tags/0.0.2 - Owner: https://github.com/sheptalo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@f1f48c7800201c21e524d421baa7853ea44af491 -
Trigger Event:
release
-
Statement type: