Metadata-Version: 2.4
Name: rapis
Version: 0.0.4
Summary: Minimalistic web framework
Author-email: shept@sinortax.ru
License: MIT License
        
        Copyright (c) 2026 sinortax
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Documentation, https://github.com/sheptalo/rapis/wiki
Project-URL: Source, https://github.com/sheptalo/rapis
Keywords: web-framework,web,async,asyncio,rsgi,granian,http
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Environment :: Web Environment
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Internet :: WWW/HTTP
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: msgspec>=0.21.1
Provides-Extra: di
Requires-Dist: dishka>=1.10.1; extra == "di"
Provides-Extra: full
Requires-Dist: dishka>=1.10.1; extra == "full"
Requires-Dist: granian>=2.7.4; extra == "full"
Provides-Extra: standard
Requires-Dist: granian>=2.7.4; extra == "standard"
Dynamic: license-file

# Rapis - Minimalistic web framework based on RSGI

[![Python versions](https://img.shields.io/pypi/pyversions/rapis.svg?color=%2334D058)](https://pypi.org/project/rapis)
[![Current version](https://img.shields.io/pypi/v/rapis?color=%2334D058&label=PyPI)](https://pypi.org/project/rapis)
[![Current status](https://img.shields.io/pypi/status/rapis)](https://pypi.org/project/rapis)
![PyPI - Downloads](https://img.shields.io/pypi/dm/rapis)

_this framework was inspired by FastAPI so syntax may be identical_

### ⚠️ WARNING: Framework 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

- [msgspec](https://github.com/jcrist/msgspec): A fast serialization and validation library

## Installation

```bash
pip install rapis
# install any rsgi compatible web-server
pip install granian
# or simply
pip install rapis[standard] # includes granian in requirements
```

## Example

```python
# 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

```bash
granian main:app
```

## Better Example

```python
# 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

```

```python
# main.py
from rapis import WebApp

from routes import router

app = WebApp()
app.include_router(router)
```

more [examples](examples)

## Performance

see [benchmarks](benchmarks)

## Docs

see [wiki](https://github.com/sheptalo/rapis/wiki)

## TODO

- [X] Exception handling
- [X] Built-in exception handlers (validation, json parsing)
- [X] Benchmarks section
- [ ] Request/Response Work model
- [ ] Docs
- [ ] More availabilities to expand logic (custom routes and other)
- [X] better Query params handle
- [X] change routing from linear to something else (hash maps for static paths, ?? for dynamic paths)
- [X] path patterns logic
- [X] review Middleware logic
- [ ] websocket support(maybe)
- [ ] coverage
- [X] typing support in TY
- [X] some examples
- [ ] Problem: how to authenticate users?
- [ ] Problem: how to send files?
- [ ] Problem: how to work with cookies?
- [ ] https://jcristharif.com/msgspec/perf-tips.html

## CONTRIBUTING

see [CONTRIBUTING.md](CONTRIBUTING.md)
