Skip to main content

Minimalistic web framework

Project description

Rapis - Minimalistic web library based on RSGI

Python versions Current version Current status PyPI - Downloads

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 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)

see more in examples

Performance

section about speed of library (WIP)

DOCS will be implemented soon

TODO

  • Exception handling
  • Built-in exception handlers (validation, json parsing)
  • 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 (partially reviewed)
  • websocket support(maybe)
  • coverage
  • typing support in TY
  • some examples
  • Problem: how to authenticate users?

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.3.tar.gz (10.8 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.3-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file rapis-0.0.3.tar.gz.

File metadata

  • Download URL: rapis-0.0.3.tar.gz
  • Upload date:
  • Size: 10.8 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.3.tar.gz
Algorithm Hash digest
SHA256 5cdc85464df6f8d6a20eab1011dd1f6b963635170c2b0639e76106e248b45034
MD5 12f2b93540842d49e557e38fe0ebdaa8
BLAKE2b-256 8e747df53e84cf8135560f64029019268bc3b1f90bce93e514c981a32b5ce9d6

See more details on using hashes here.

Provenance

The following attestation bundles were made for rapis-0.0.3.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.3-py3-none-any.whl.

File metadata

  • Download URL: rapis-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 11.2 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d00905a8050e75c8b0f39ee5a62ea0f681e5d6f1513962c383e08accb500a6a4
MD5 8ab1715cbcc0890bdd4f3f9cb7425e32
BLAKE2b-256 5cea4ee1c0923176114ad6d1cae23b295876191dbaf641655d4d76271267de06

See more details on using hashes here.

Provenance

The following attestation bundles were made for rapis-0.0.3-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