Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rapis-0.0.2.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rapis-0.0.2-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

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

Hashes for rapis-0.0.2.tar.gz
Algorithm Hash digest
SHA256 aaf8356fdb73ea7b8e8829b2b8695357208746d3abf30ef33893664e59131592
MD5 350752dd4d6384b2411bb820517896b3
BLAKE2b-256 8c6300a0ad9b0631917ad4d574655333ad00ef4da98d63c897da7dd7a0cd5dfd

See more details on using hashes here.

Provenance

The following attestation bundles were made for rapis-0.0.2.tar.gz:

Publisher: python-publish.yml on sheptalo/rapis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for rapis-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1b98ddf76297263438ff9b2078eb47b675289d964ee62839d5095c5533d3f6a0
MD5 e3dd6f37a970c7281e1906e9922ba485
BLAKE2b-256 4def70f0ae111e455dec9447313f06d96b73f825db87572ae143f397be6a377f

See more details on using hashes here.

Provenance

The following attestation bundles were made for rapis-0.0.2-py3-none-any.whl:

Publisher: python-publish.yml on sheptalo/rapis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page