ravyn


Nameravyn JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryRavyn combines performance, type safety, and elegance. A next-generation async Python framework for APIs, microservices, and web applications.
upload_time2025-10-06 14:40:28
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseNone
keywords ai aiohttp anyio aop api api-key api-server asgi async async-framework asyncio authentication auto-documentation autodoc backend background-tasks caching cloud-native concurrency controllers cors csrf data-validation dependency-injection developer-friendly django dymmond esmerald event-driven exception-handling fastapi flask graphql graphql-support high-performance http hypercorn interceptors json jwt lilya machine-learning microservices middlewares ml modern-python non-blocking oauth2 observables openapi openapi-schema openapi3 pydantic python python-types python3 quart ravyn ravyn-framework redoc request-handling response-models rest rest-api routing security serialization sse starlette streaming swagger type-hints typed-api uvicorn validation web web-framework websocket websocket-server
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Ravyn

<p align="center">
  <a href="https://ravyn.dev"><img src="https://res.cloudinary.com/dymmond/image/upload/v1759490296/ravyn/img/logo_pb3fis.png" alt='Ravyn'></a>
</p>

<p align="center">
    <em>🚀 Performance, type safety, and elegance. A next-generation async Python framework for APIs, microservices, and web applications. 🚀</em>
</p>

<p align="center">
<a href="https://github.com/dymmond/ravyn/actions/workflows/test-suite.yml/badge.svg?event=push&branch=main" target="_blank">
    <img src="https://github.com/dymmond/ravyn/actions/workflows/test-suite.yml/badge.svg?event=push&branch=main" alt="Test Suite">
</a>

<a href="https://pypi.org/project/ravyn" target="_blank">
    <img src="https://img.shields.io/pypi/v/ravyn?color=%2334D058&label=pypi%20package" alt="Package version">
</a>

<a href="https://pypi.org/project/ravyn" target="_blank">
    <img src="https://img.shields.io/pypi/pyversions/ravyn.svg?color=%2334D058" alt="Supported Python versions">
</a>
</p>

---

**Documentation**: [https://ravyn.dev](https://www.ravyn.dev) 📚

**Source Code**: [https://github.com/dymmond/ravyn](https://github.com/dymmond/ravyn)

**The official supported version is always the latest released**.

**If you came to look for Esmerald, you are in the right place. Esmerald was rebranded to Ravyn**.

---

Ravyn is a modern, powerful, flexible, high performant, web framework designed to build not only APIs
but also full scalable applications from the smallest to enterprise level.

Ravyn is designed to build with Python 3.10+ and based on standard python type hints. Initially
built on the top of [Starlette](https://github.com/encode/starlette) and later on moved to [Lilya](https://lilya.dev) and [Pydantic](https://github.com/samuelcolvin/pydantic)/[msgspec](https://jcristharif.com/msgspec/).

Check out the [Ravyn documentation 📚](https://ravyn.dev)

**The official supported version is always the latest released**.

## History Behind Ravyn

Why is this happening? Is Esmerald going away? **No, absolutely not. Esmerald remains and will remain as is and will keep growing**
as it has its own use cases.

The reason for the rebranding its because the ecosystem has grown a lot and Esmerald was the first tool being created.
Since then it was released as version 3+.

This happened because of internal dependencies, and we already removed all of them but goes a bit off compared to the rest
of the ecosystem.

This is the reason for Ravyn to come into existence and to keep everything aligned with the future projects coming out.

## Motivation

There are great frameworks out there like FastAPI, Flama, Flask, Django... All of them solving majority
of the current day-to-day problems of 99% of the applications but leaving the 1% that is usually around structure
and design/business without to much to do.

Ravyn got the inspiration from those great frameworks out there and was built with all the known amazing
features but with business in mind as well. Starlite, for example, at the very beginning, gave the inspiration for the transformers and for the Signature models,
something very useful that helped Ravyn integerating with pydantic.
FastAPI gave the inspiration for API designing, Django for the permissions, Flask for the simplicity, NestJS for the
controllers and the list goes on.

For a job to be done properly, usually it is never done alone and there is always a driver and inspiration to it.

## Requirements

* Python 3.10+

Ravyn wouldn't be possible without two pillars:

* <a href="https://www.lilya.dev/" class="external-link" target="_blank">Lilya</a>
* <a href="https://pydantic-docs.helpmanual.io/" class="external-link" target="_blank">Pydantic</a>

## Installation

```shell
$ pip install ravyn
```

**If you want the ravyn client and all the niceties**

```shell
$ pip install ravyn[standard]
```

An ASGI server is also needed to run in production, we recommend [Uvicorn](https://www.uvicorn.org) but it is entirely
up to you.

```shell
$ pip install uvicorn

```

If you want install ravyn with specifics:

**Support for the internal scheduler**:

```shell
$ pip install ravyn[schedulers]
```

**Support for the jwt used internally by Ravyn**:

```shell
$ pip install ravyn[jwt]
```

**If you want to use the ravyn testing client**:

```shell
$ pip install ravyn[test]
```

**If you want to use the ravyn shell**:

More [details](https://ravyn.dev/directives/shell) about this topic [in the docs](https://ravyn.dev/directives/shell)

```shell
$ pip install ravyn[ipython] # default shell
$ pip install ravyn[ptpython] # ptpython shell
```

### Start a project using directives

!!! Warning
    This is for more advanced users that are already comfortable with Ravyn (or Python in general)
    or feel like it is not a problem using these directives. If you do not feel comfortable yet to use this,
    please continue reading the documentation and learning more about Ravyn.

If you wish to start an Ravyn project with a simple suggested structure.

```shell
ravyn createproject <YOUR-PROJECT-NAME> --simple
```

This will generate a scaffold for your project with some pre-defined files in a simple fashion with a simple ready to
go Ravyn application.

This will also generate a file for the tests using the ravynTestClient, so make sure you run:

```shell
$ pip install ravyn[test]
```

Or you can skip this step if you don't want to use the ravynTestClient.

You can find [more information](https://ravyn.dev/management/directives) about this directive and how to
use it.

## Key Features

* **Fluid and Fast**: Thanks to Starlette and Pydantic/msgspec.
* **Fast to develop**: Thanks to the simplicity of design, the development times can be reduced exponentially.
* **Intuitive**: If you are used to the other frameworks, Ravyn is a no brainer to develop.
* **Easy**: Developed with design in mind and easy learning.
* **Short**: With the OOP available natively there is no need for code duplication. SOLID.
* **Ready**: Get your application up and running with production-ready code.
* **OOP and Functional**: Design APIs in any desired way. OOP or Functional is available.
* **Async and Sync**: Do you prefer sync or async? You can have both.
* **Middleware**: Apply middlewares on the application level or API level.
* **Exception Handlers**: Apply exception handlers on any desired level.
* **Permissions**: Apply specific rules and permissions on each API.
* **Interceptors**: Intercept requests and add logic before reaching the endpoint.
* **Observables** - Support for observables allowing to create reactive programming within your application
* **Extensions**: Create plugins for Ravyn and hook them into any application and/or
distribute them.
* **DAO and AsyncDAO**: Avoid database calls directly from the APIs. Use business objects instead.
* **ORM Support**: Native support for [Edgy][edgy_orm].
* **ODM Support**: Native support for [Mongoz][mongoz_odm].
* **Controller**: Class Based endpoints for your beloved OOP design.
* **JSON serialization/deserialization**: Both UJSON and ORJON support.
* **Lifespan**: Support for the newly lifespan and on_start/on_shutdown events.
* **Scheduler**: Yes, that's right, it comes with a scheduler for those automated tasks.
* **Dependency Injection**: Like any other great framework out there.
* **Simplicity from settings**: Yes, we have a way to make the code even cleaner by introducing settings
based systems.
* **Encoders** - Support for custom encoders allowing compatibility with any favourity validation library: `msgspec`, `attrs`....

And a lot more...

## Relation to Starlette and other frameworks

Ravyn uses Starlette under the hood. The reason behind this decison comes with the fact that performance is there
and no issues with routing.

Once the application is up, all the routes are mounted and therefore the url paths are defined.
Ravyn encourages standard practices and design in mind which means that any application, big or small,
custom or enterprise, fits within Ravyn ecosystem without scalability issues.

## Quickstart

To quickly start with Ravyn, you can just do this. Using `uvicorn` as example.

```python
#!/usr/bin/env python
import uvicorn

from ravyn import Ravyn, Gateway, JSONResponse, Request, get


@get()
def welcome() -> JSONResponse:
    return JSONResponse({"message": "Welcome to Ravyn"})


@get()
def user(user: str) -> JSONResponse:
    return JSONResponse({"message": f"Welcome to Ravyn, {user}"})


@get()
def user_in_request(request: Request) -> JSONResponse:
    user = request.path_params["user"]
    return JSONResponse({"message": f"Welcome to Ravyn, {user}"})


app = Ravyn(
    routes=[
        Gateway("/ravyn", handler=welcome),
        Gateway("/ravyn/{user}", handler=user),
        Gateway("/ravyn/in-request/{user}", handler=user_in_request),
    ]
)

if __name__ == "__main__":
    uvicorn.run(app, port=8000)
```

Then you can access the endpoints.

### Using Ravyn as a decorator

To quickly start with Ravyn you can also use it as decorator, you can just do this. Using `uvicorn` as example.

```python
#!/usr/bin/env python
import uvicorn

from ravyn import Ravyn, Gateway, JSONResponse, Request, get

app = Ravyn()


@app.get("/ravyn")
def welcome() -> JSONResponse:
    return JSONResponse({"message": "Welcome to Ravyn"})


@app.get("/ravyn/{user}")
def user(user: str) -> JSONResponse:
    return JSONResponse({"message": f"Welcome to Ravyn, {user}"})


@app.get("/ravyn/in-request/{user}")
def user_in_request(request: Request) -> JSONResponse:
    user = request.path_params["user"]
    return JSONResponse({"message": f"Welcome to Ravyn, {user}"})


if __name__ == "__main__":
    uvicorn.run(app, port=8000)
```

## Settings

Like every other framework, when starting an application, a lot of [settings](./application/settings.md) can/need to be
passed to the main object and this can be very dauting and ugly to maintain and see.

Ravyn comes with the
[settings](./application/settings.md) in mind. A set of defaults that can be overridden by your very own settings
module but not limited to it, as you can still use the classic approach of passing everything into a
Ravyn instance directly when instantiating.

**Example of classic approach**:

```python
from example import ExampleObject

# ExampleObject is an instance of another application
# and it serves only for example

app = ExampleObject(setting_one=..., setting_two=..., setting_three=...)

```

Inspired by the great [Django](https://www.djangoproject.com/) and using pydantic, Ravyn has a default object
ready to be used out-of-the-box.

**Ravyn**:

```python
from ravyn import Ravyn

app = Ravyn()

```

And that's it! All the default settings are loaded! This is simple of course but can you override
inside the object as well? Yes!

```python
from ravyn import Ravyn

app = Ravyn(app_name='My App', title='My title')

```

Same as the classics.

So how does Ravyn know about the default settings? Enters [Ravyn settings module](#ravyn-settings-module).

### Ravyn Settings Module

This is the way Ravyn defaults the values. When starting an application, the system looks for a
`RAVYN_SETTINGS_MODULE` environment variable. If no variable is supplied then the system will default to
`RavynSettings` settings and start.

### Custom Settings

Separation of settings by enviromment is a must have these days and starting with default of Ravyn will not be
enough for any application.

The settings are pydantic standard settings and therefore compatible with Ravyn.
The system brings some defaults that can be used out-of-the-box but it's not mandatory to be used.
The environment defaults to **production**.

```python

from ravyn import RavynSettings
from ravyn.conf.enums import EnvironmentType


class Development(RavynSettings):
    app_name: str = 'My app in dev'
    environment: str = EnvironmentType.DEVELOPMENT

```

**Load the settings into your Ravyn application**:

Assuming your Ravyn app is inside an `src/app.py`.

```console

RAVYN_SETTINGS_MODULE='myapp.settings.Development' python -m src.app.py

```

## Gateway, WebSocketGateway and Include

Starlette offers the Route classes for simple path assignments but this is also very limiting if something more
complex in mind. Ravyn extends that functionality and adds some `flair` and levels up by having the
Gateway, WebSocketGateway and Include.

Those are special objects that allow all the magic of Ravyn to happen.

For a classic, direct, one file single approach.

**In a nutshell**:

```python title='src/app.py'
from ravyn import Ravyn, get, status, Request, ORJSONResponse, Gateway, WebSocketGateway, Websocket


@get(status_code=status.HTTP_200_OK)
async def home() -> ORJSONResponse:
    return ORJSONResponse({
        "detail": "Hello world"
    })


@get()
async def another(request: Request) -> dict:
    return {
        "detail": "Another world!"
    }


@websocket(path="/{path_param:str}")
async def world_socket(socket: Websocket) -> None:
    await socket.accept()
    msg = await socket.receive_json()
    assert msg
    assert socket
    await socket.close()


app = Ravyn(routes=[
    Gateway(handler=home),
    Gateway(handler=another),
    WebSocketGateway(handler=world_socket),
])

```

## Design in mind

Good design is always encouraged and Ravyn allows complex routing on any level.

### The handlers (views)

```python title="myapp/accounts/controllers.py"
from ravyn import get, post, put, status, websocket, APIView, Request, JSONResponse, Response, WebSocket
from pydantic import BaseModel


class Product(BaseModel):
    name: str
    sku: str
    price: float


@put('/product/{product_id}')
def update_product(product_id: int, data: Product) -> dict:
    return {"product_id": product_id, "product_name": product.name}


@get(status_code=status.HTTP_200_OK)
async def home() -> JSONResponse:
    return JSONResponse({
        "detail": "Hello world"
    })


@get()
async def another(request: Request) -> dict:
    return {
        "detail": "Another world!"
    }


@websocket(path="/{path_param:str}")
async def world_socket(socket: Websocket) -> None:
    await socket.accept()
    msg = await socket.receive_json()
    assert msg
    assert socket
    await socket.close()


class World(APIView):

    @get(path='/{url}')
    async def home(self, request: Request, url: str) -> Response:
        return Response(f"URL: {url}")

    @post(path='/{url}', status_code=status.HTTP_201_CREATED)
    async def mars(self, request: Request, url: str) -> JSONResponse:
        ...

    @websocket(path="/{path_param:str}")
    async def pluto(self, socket: Websocket) -> None:
        await socket.accept()
        msg = await socket.receive_json()
        assert msg
        assert socket
        await socket.close()


```

If a `path` is not provided, defaults to `/`.

### The gateways (urls)

```python title="myapp/accounts/urls.py"
from ravyn import Gateway, WebSocketGateway
from .controllers import home, another, world_socket, World

route_patterns = [
    Gateway(handler=update_product),
    Gateway(handler=home),
    Gateway(handler=another),
    Gateway(handler=World),
    WebSocketGateway(handler=world_socket),
]

```

If a `path` is not provided, defaults to `/`.

### The Include

This is a very special object that allows the import of any route from anywhere in the application.

`Include` accepts the import via `namespace` or via `routes` list but not both.

When using a `namespace`, the `Include` will look for the default `route_patterns` object list in the imported
namespace unless a different `pattern` is specified.

The pattern only works if the imports are done via `namespace` and not via `routes`.

**Importing using namespace**:

```python title='myapp/urls.py'
from ravyn import Include

route_patterns = [
    Include(namespace='myapp.accounts.urls')
]

```

**Importing using routes**:

```python title='src/myapp/urls.py'
from ravyn import Include
from myapp.accounts import urls

route_patterns = [
    Include(routes=urls.route_patterns)
]

```

If a `path` is not provided, defaults to `/`.

#### Using a different pattern

```python title="src/myapp/accounts/urls.py"
from ravyn import Gateway, WebSocketGateway
from .controllers import home, another, world_socket, World

my_urls = [
    Gateway(handler=update_product),
    Gateway(handler=home),
    Gateway(handler=another),
    Gateway(handler=World),
    WebSocketGateway(handler=world_socket),
]

```

**Importing using namespace**:

```python title='src/myapp/urls.py'
from ravyn import Include

route_patterns = [
    Include(namespace='myapp.accounts.urls', pattern='my_urls')
]

```

## Include and Ravyn

The `Include` can be very helpful mostly when the goal is to avoid a lot of imports and massive list
of objects to be passed into one single object. This can be particulary useful to make a Ravyn instance.

**Example**:

```python title='src/urls.py'
from ravyn import Include

route_patterns = [
    Include(namespace='myapp.accounts.urls', pattern='my_urls')
]

```

```python title='src/app.py'
from ravyn import Ravyn, Include

app = Ravyn(routes=[Include('src.urls')])

```

## Run the application

As mentioned before, we recommend uvicorn for production but it's not mandatory.

**Using uvicorn**:

```shell
uvicorn src:app --reload

INFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO:     Started reloader process [28720]
INFO:     Started server process [28722]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
```

## Run the application with custom settings

**Using uvicorn**:

```shell
RAVYN_SETTINGS_MODULE=myapp.AppSettings uvicorn src:app --reload

INFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO:     Started reloader process [28720]
INFO:     Started server process [28722]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
```

## OpenAPI documentation

Ravyn also comes with OpenAPI docs integrated. For those used to that, this is roughly the same and to make it
happen, there were inspirations that helped Ravyn getting there fast.

Ravyn starts automatically the OpenAPI documentation by injecting the OpenAPIConfig default from
the settings and makes Swagger, ReDoc an Stoplight elements available to you out of the box.

To access the OpenAPI, simply start your local development and access:

* **Swagger** - `/docs/swagger`.
* **Redoc** - `/docs/redoc`.
* **Stoplight Elements** - `/docs/elements`.

There are more details about [how to configure the OpenAPIConfig](https://ravyn.dev/configurations/openapi/config)
within the documentation.

There is also a good explanation on how to use the [OpenAPIResponse](https://ravyn.dev/responses#openapi-responses)
as well.

## Notes

This is just a very high-level demonstration of how to start quickly and what Ravyn can do.
There are plenty more things you can do with Ravyn. Enjoy! 😊

## Sponsors

Currently there are no sponsors of Ravyn but you can financially help and support the author though
[GitHub sponsors](https://github.com/sponsors/tarsil) and become a **Special one** or a **Legend**.

### Powered by

Worth mentioning who is helping us.

**JetBrains**

[![JetBrains logo.](https://resources.jetbrains.com/storage/products/company/brand/logos/jetbrains.svg)](https://jb.gg/OpenSourceSupport)

[edgy_orm]: https://ravyn.dev/databases/edgy/motivation
[mongoz_odm]: https://ravyn.dev/databases/mongoz/motivation

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "ravyn",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "ai, aiohttp, anyio, aop, api, api-key, api-server, asgi, async, async-framework, asyncio, authentication, auto-documentation, autodoc, backend, background-tasks, caching, cloud-native, concurrency, controllers, cors, csrf, data-validation, dependency-injection, developer-friendly, django, dymmond, esmerald, event-driven, exception-handling, fastapi, flask, graphql, graphql-support, high-performance, http, hypercorn, interceptors, json, jwt, lilya, machine-learning, microservices, middlewares, ml, modern-python, non-blocking, oauth2, observables, openapi, openapi-schema, openapi3, pydantic, python, python-types, python3, quart, ravyn, ravyn-framework, redoc, request-handling, response-models, rest, rest-api, routing, security, serialization, sse, starlette, streaming, swagger, type-hints, typed-api, uvicorn, validation, web, web-framework, websocket, websocket-server",
    "author": null,
    "author_email": "Tiago Silva <tiago.silva@dymmond.com>",
    "download_url": "https://files.pythonhosted.org/packages/78/28/00d9c20809f229e88376b6fbc4220dae24efb8f321de139c33abb2fb5556/ravyn-0.1.0.tar.gz",
    "platform": null,
    "description": "# Ravyn\n\n<p align=\"center\">\n  <a href=\"https://ravyn.dev\"><img src=\"https://res.cloudinary.com/dymmond/image/upload/v1759490296/ravyn/img/logo_pb3fis.png\" alt='Ravyn'></a>\n</p>\n\n<p align=\"center\">\n    <em>\ud83d\ude80 Performance, type safety, and elegance. A next-generation async Python framework for APIs, microservices, and web applications. \ud83d\ude80</em>\n</p>\n\n<p align=\"center\">\n<a href=\"https://github.com/dymmond/ravyn/actions/workflows/test-suite.yml/badge.svg?event=push&branch=main\" target=\"_blank\">\n    <img src=\"https://github.com/dymmond/ravyn/actions/workflows/test-suite.yml/badge.svg?event=push&branch=main\" alt=\"Test Suite\">\n</a>\n\n<a href=\"https://pypi.org/project/ravyn\" target=\"_blank\">\n    <img src=\"https://img.shields.io/pypi/v/ravyn?color=%2334D058&label=pypi%20package\" alt=\"Package version\">\n</a>\n\n<a href=\"https://pypi.org/project/ravyn\" target=\"_blank\">\n    <img src=\"https://img.shields.io/pypi/pyversions/ravyn.svg?color=%2334D058\" alt=\"Supported Python versions\">\n</a>\n</p>\n\n---\n\n**Documentation**: [https://ravyn.dev](https://www.ravyn.dev) \ud83d\udcda\n\n**Source Code**: [https://github.com/dymmond/ravyn](https://github.com/dymmond/ravyn)\n\n**The official supported version is always the latest released**.\n\n**If you came to look for Esmerald, you are in the right place. Esmerald was rebranded to Ravyn**.\n\n---\n\nRavyn is a modern, powerful, flexible, high performant, web framework designed to build not only APIs\nbut also full scalable applications from the smallest to enterprise level.\n\nRavyn is designed to build with Python 3.10+ and based on standard python type hints. Initially\nbuilt on the top of [Starlette](https://github.com/encode/starlette) and later on moved to [Lilya](https://lilya.dev) and [Pydantic](https://github.com/samuelcolvin/pydantic)/[msgspec](https://jcristharif.com/msgspec/).\n\nCheck out the [Ravyn documentation \ud83d\udcda](https://ravyn.dev)\n\n**The official supported version is always the latest released**.\n\n## History Behind Ravyn\n\nWhy is this happening? Is Esmerald going away? **No, absolutely not. Esmerald remains and will remain as is and will keep growing**\nas it has its own use cases.\n\nThe reason for the rebranding its because the ecosystem has grown a lot and Esmerald was the first tool being created.\nSince then it was released as version 3+.\n\nThis happened because of internal dependencies, and we already removed all of them but goes a bit off compared to the rest\nof the ecosystem.\n\nThis is the reason for Ravyn to come into existence and to keep everything aligned with the future projects coming out.\n\n## Motivation\n\nThere are great frameworks out there like FastAPI, Flama, Flask, Django... All of them solving majority\nof the current day-to-day problems of 99% of the applications but leaving the 1% that is usually around structure\nand design/business without to much to do.\n\nRavyn got the inspiration from those great frameworks out there and was built with all the known amazing\nfeatures but with business in mind as well. Starlite, for example, at the very beginning, gave the inspiration for the transformers and for the Signature models,\nsomething very useful that helped Ravyn integerating with pydantic.\nFastAPI gave the inspiration for API designing, Django for the permissions, Flask for the simplicity, NestJS for the\ncontrollers and the list goes on.\n\nFor a job to be done properly, usually it is never done alone and there is always a driver and inspiration to it.\n\n## Requirements\n\n* Python 3.10+\n\nRavyn wouldn't be possible without two pillars:\n\n* <a href=\"https://www.lilya.dev/\" class=\"external-link\" target=\"_blank\">Lilya</a>\n* <a href=\"https://pydantic-docs.helpmanual.io/\" class=\"external-link\" target=\"_blank\">Pydantic</a>\n\n## Installation\n\n```shell\n$ pip install ravyn\n```\n\n**If you want the ravyn client and all the niceties**\n\n```shell\n$ pip install ravyn[standard]\n```\n\nAn ASGI server is also needed to run in production, we recommend [Uvicorn](https://www.uvicorn.org) but it is entirely\nup to you.\n\n```shell\n$ pip install uvicorn\n\n```\n\nIf you want install ravyn with specifics:\n\n**Support for the internal scheduler**:\n\n```shell\n$ pip install ravyn[schedulers]\n```\n\n**Support for the jwt used internally by Ravyn**:\n\n```shell\n$ pip install ravyn[jwt]\n```\n\n**If you want to use the ravyn testing client**:\n\n```shell\n$ pip install ravyn[test]\n```\n\n**If you want to use the ravyn shell**:\n\nMore [details](https://ravyn.dev/directives/shell) about this topic [in the docs](https://ravyn.dev/directives/shell)\n\n```shell\n$ pip install ravyn[ipython] # default shell\n$ pip install ravyn[ptpython] # ptpython shell\n```\n\n### Start a project using directives\n\n!!! Warning\n    This is for more advanced users that are already comfortable with Ravyn (or Python in general)\n    or feel like it is not a problem using these directives. If you do not feel comfortable yet to use this,\n    please continue reading the documentation and learning more about Ravyn.\n\nIf you wish to start an Ravyn project with a simple suggested structure.\n\n```shell\nravyn createproject <YOUR-PROJECT-NAME> --simple\n```\n\nThis will generate a scaffold for your project with some pre-defined files in a simple fashion with a simple ready to\ngo Ravyn application.\n\nThis will also generate a file for the tests using the ravynTestClient, so make sure you run:\n\n```shell\n$ pip install ravyn[test]\n```\n\nOr you can skip this step if you don't want to use the ravynTestClient.\n\nYou can find [more information](https://ravyn.dev/management/directives) about this directive and how to\nuse it.\n\n## Key Features\n\n* **Fluid and Fast**: Thanks to Starlette and Pydantic/msgspec.\n* **Fast to develop**: Thanks to the simplicity of design, the development times can be reduced exponentially.\n* **Intuitive**: If you are used to the other frameworks, Ravyn is a no brainer to develop.\n* **Easy**: Developed with design in mind and easy learning.\n* **Short**: With the OOP available natively there is no need for code duplication. SOLID.\n* **Ready**: Get your application up and running with production-ready code.\n* **OOP and Functional**: Design APIs in any desired way. OOP or Functional is available.\n* **Async and Sync**: Do you prefer sync or async? You can have both.\n* **Middleware**: Apply middlewares on the application level or API level.\n* **Exception Handlers**: Apply exception handlers on any desired level.\n* **Permissions**: Apply specific rules and permissions on each API.\n* **Interceptors**: Intercept requests and add logic before reaching the endpoint.\n* **Observables** - Support for observables allowing to create reactive programming within your application\n* **Extensions**: Create plugins for Ravyn and hook them into any application and/or\ndistribute them.\n* **DAO and AsyncDAO**: Avoid database calls directly from the APIs. Use business objects instead.\n* **ORM Support**: Native support for [Edgy][edgy_orm].\n* **ODM Support**: Native support for [Mongoz][mongoz_odm].\n* **Controller**: Class Based endpoints for your beloved OOP design.\n* **JSON serialization/deserialization**: Both UJSON and ORJON support.\n* **Lifespan**: Support for the newly lifespan and on_start/on_shutdown events.\n* **Scheduler**: Yes, that's right, it comes with a scheduler for those automated tasks.\n* **Dependency Injection**: Like any other great framework out there.\n* **Simplicity from settings**: Yes, we have a way to make the code even cleaner by introducing settings\nbased systems.\n* **Encoders** - Support for custom encoders allowing compatibility with any favourity validation library: `msgspec`, `attrs`....\n\nAnd a lot more...\n\n## Relation to Starlette and other frameworks\n\nRavyn uses Starlette under the hood. The reason behind this decison comes with the fact that performance is there\nand no issues with routing.\n\nOnce the application is up, all the routes are mounted and therefore the url paths are defined.\nRavyn encourages standard practices and design in mind which means that any application, big or small,\ncustom or enterprise, fits within Ravyn ecosystem without scalability issues.\n\n## Quickstart\n\nTo quickly start with Ravyn, you can just do this. Using `uvicorn` as example.\n\n```python\n#!/usr/bin/env python\nimport uvicorn\n\nfrom ravyn import Ravyn, Gateway, JSONResponse, Request, get\n\n\n@get()\ndef welcome() -> JSONResponse:\n    return JSONResponse({\"message\": \"Welcome to Ravyn\"})\n\n\n@get()\ndef user(user: str) -> JSONResponse:\n    return JSONResponse({\"message\": f\"Welcome to Ravyn, {user}\"})\n\n\n@get()\ndef user_in_request(request: Request) -> JSONResponse:\n    user = request.path_params[\"user\"]\n    return JSONResponse({\"message\": f\"Welcome to Ravyn, {user}\"})\n\n\napp = Ravyn(\n    routes=[\n        Gateway(\"/ravyn\", handler=welcome),\n        Gateway(\"/ravyn/{user}\", handler=user),\n        Gateway(\"/ravyn/in-request/{user}\", handler=user_in_request),\n    ]\n)\n\nif __name__ == \"__main__\":\n    uvicorn.run(app, port=8000)\n```\n\nThen you can access the endpoints.\n\n### Using Ravyn as a decorator\n\nTo quickly start with Ravyn you can also use it as decorator, you can just do this. Using `uvicorn` as example.\n\n```python\n#!/usr/bin/env python\nimport uvicorn\n\nfrom ravyn import Ravyn, Gateway, JSONResponse, Request, get\n\napp = Ravyn()\n\n\n@app.get(\"/ravyn\")\ndef welcome() -> JSONResponse:\n    return JSONResponse({\"message\": \"Welcome to Ravyn\"})\n\n\n@app.get(\"/ravyn/{user}\")\ndef user(user: str) -> JSONResponse:\n    return JSONResponse({\"message\": f\"Welcome to Ravyn, {user}\"})\n\n\n@app.get(\"/ravyn/in-request/{user}\")\ndef user_in_request(request: Request) -> JSONResponse:\n    user = request.path_params[\"user\"]\n    return JSONResponse({\"message\": f\"Welcome to Ravyn, {user}\"})\n\n\nif __name__ == \"__main__\":\n    uvicorn.run(app, port=8000)\n```\n\n## Settings\n\nLike every other framework, when starting an application, a lot of [settings](./application/settings.md) can/need to be\npassed to the main object and this can be very dauting and ugly to maintain and see.\n\nRavyn comes with the\n[settings](./application/settings.md) in mind. A set of defaults that can be overridden by your very own settings\nmodule but not limited to it, as you can still use the classic approach of passing everything into a\nRavyn instance directly when instantiating.\n\n**Example of classic approach**:\n\n```python\nfrom example import ExampleObject\n\n# ExampleObject is an instance of another application\n# and it serves only for example\n\napp = ExampleObject(setting_one=..., setting_two=..., setting_three=...)\n\n```\n\nInspired by the great [Django](https://www.djangoproject.com/) and using pydantic, Ravyn has a default object\nready to be used out-of-the-box.\n\n**Ravyn**:\n\n```python\nfrom ravyn import Ravyn\n\napp = Ravyn()\n\n```\n\nAnd that's it! All the default settings are loaded! This is simple of course but can you override\ninside the object as well? Yes!\n\n```python\nfrom ravyn import Ravyn\n\napp = Ravyn(app_name='My App', title='My title')\n\n```\n\nSame as the classics.\n\nSo how does Ravyn know about the default settings? Enters [Ravyn settings module](#ravyn-settings-module).\n\n### Ravyn Settings Module\n\nThis is the way Ravyn defaults the values. When starting an application, the system looks for a\n`RAVYN_SETTINGS_MODULE` environment variable. If no variable is supplied then the system will default to\n`RavynSettings` settings and start.\n\n### Custom Settings\n\nSeparation of settings by enviromment is a must have these days and starting with default of Ravyn will not be\nenough for any application.\n\nThe settings are pydantic standard settings and therefore compatible with Ravyn.\nThe system brings some defaults that can be used out-of-the-box but it's not mandatory to be used.\nThe environment defaults to **production**.\n\n```python\n\nfrom ravyn import RavynSettings\nfrom ravyn.conf.enums import EnvironmentType\n\n\nclass Development(RavynSettings):\n    app_name: str = 'My app in dev'\n    environment: str = EnvironmentType.DEVELOPMENT\n\n```\n\n**Load the settings into your Ravyn application**:\n\nAssuming your Ravyn app is inside an `src/app.py`.\n\n```console\n\nRAVYN_SETTINGS_MODULE='myapp.settings.Development' python -m src.app.py\n\n```\n\n## Gateway, WebSocketGateway and Include\n\nStarlette offers the Route classes for simple path assignments but this is also very limiting if something more\ncomplex in mind. Ravyn extends that functionality and adds some `flair` and levels up by having the\nGateway, WebSocketGateway and Include.\n\nThose are special objects that allow all the magic of Ravyn to happen.\n\nFor a classic, direct, one file single approach.\n\n**In a nutshell**:\n\n```python title='src/app.py'\nfrom ravyn import Ravyn, get, status, Request, ORJSONResponse, Gateway, WebSocketGateway, Websocket\n\n\n@get(status_code=status.HTTP_200_OK)\nasync def home() -> ORJSONResponse:\n    return ORJSONResponse({\n        \"detail\": \"Hello world\"\n    })\n\n\n@get()\nasync def another(request: Request) -> dict:\n    return {\n        \"detail\": \"Another world!\"\n    }\n\n\n@websocket(path=\"/{path_param:str}\")\nasync def world_socket(socket: Websocket) -> None:\n    await socket.accept()\n    msg = await socket.receive_json()\n    assert msg\n    assert socket\n    await socket.close()\n\n\napp = Ravyn(routes=[\n    Gateway(handler=home),\n    Gateway(handler=another),\n    WebSocketGateway(handler=world_socket),\n])\n\n```\n\n## Design in mind\n\nGood design is always encouraged and Ravyn allows complex routing on any level.\n\n### The handlers (views)\n\n```python title=\"myapp/accounts/controllers.py\"\nfrom ravyn import get, post, put, status, websocket, APIView, Request, JSONResponse, Response, WebSocket\nfrom pydantic import BaseModel\n\n\nclass Product(BaseModel):\n    name: str\n    sku: str\n    price: float\n\n\n@put('/product/{product_id}')\ndef update_product(product_id: int, data: Product) -> dict:\n    return {\"product_id\": product_id, \"product_name\": product.name}\n\n\n@get(status_code=status.HTTP_200_OK)\nasync def home() -> JSONResponse:\n    return JSONResponse({\n        \"detail\": \"Hello world\"\n    })\n\n\n@get()\nasync def another(request: Request) -> dict:\n    return {\n        \"detail\": \"Another world!\"\n    }\n\n\n@websocket(path=\"/{path_param:str}\")\nasync def world_socket(socket: Websocket) -> None:\n    await socket.accept()\n    msg = await socket.receive_json()\n    assert msg\n    assert socket\n    await socket.close()\n\n\nclass World(APIView):\n\n    @get(path='/{url}')\n    async def home(self, request: Request, url: str) -> Response:\n        return Response(f\"URL: {url}\")\n\n    @post(path='/{url}', status_code=status.HTTP_201_CREATED)\n    async def mars(self, request: Request, url: str) -> JSONResponse:\n        ...\n\n    @websocket(path=\"/{path_param:str}\")\n    async def pluto(self, socket: Websocket) -> None:\n        await socket.accept()\n        msg = await socket.receive_json()\n        assert msg\n        assert socket\n        await socket.close()\n\n\n```\n\nIf a `path` is not provided, defaults to `/`.\n\n### The gateways (urls)\n\n```python title=\"myapp/accounts/urls.py\"\nfrom ravyn import Gateway, WebSocketGateway\nfrom .controllers import home, another, world_socket, World\n\nroute_patterns = [\n    Gateway(handler=update_product),\n    Gateway(handler=home),\n    Gateway(handler=another),\n    Gateway(handler=World),\n    WebSocketGateway(handler=world_socket),\n]\n\n```\n\nIf a `path` is not provided, defaults to `/`.\n\n### The Include\n\nThis is a very special object that allows the import of any route from anywhere in the application.\n\n`Include` accepts the import via `namespace` or via `routes` list but not both.\n\nWhen using a `namespace`, the `Include` will look for the default `route_patterns` object list in the imported\nnamespace unless a different `pattern` is specified.\n\nThe pattern only works if the imports are done via `namespace` and not via `routes`.\n\n**Importing using namespace**:\n\n```python title='myapp/urls.py'\nfrom ravyn import Include\n\nroute_patterns = [\n    Include(namespace='myapp.accounts.urls')\n]\n\n```\n\n**Importing using routes**:\n\n```python title='src/myapp/urls.py'\nfrom ravyn import Include\nfrom myapp.accounts import urls\n\nroute_patterns = [\n    Include(routes=urls.route_patterns)\n]\n\n```\n\nIf a `path` is not provided, defaults to `/`.\n\n#### Using a different pattern\n\n```python title=\"src/myapp/accounts/urls.py\"\nfrom ravyn import Gateway, WebSocketGateway\nfrom .controllers import home, another, world_socket, World\n\nmy_urls = [\n    Gateway(handler=update_product),\n    Gateway(handler=home),\n    Gateway(handler=another),\n    Gateway(handler=World),\n    WebSocketGateway(handler=world_socket),\n]\n\n```\n\n**Importing using namespace**:\n\n```python title='src/myapp/urls.py'\nfrom ravyn import Include\n\nroute_patterns = [\n    Include(namespace='myapp.accounts.urls', pattern='my_urls')\n]\n\n```\n\n## Include and Ravyn\n\nThe `Include` can be very helpful mostly when the goal is to avoid a lot of imports and massive list\nof objects to be passed into one single object. This can be particulary useful to make a Ravyn instance.\n\n**Example**:\n\n```python title='src/urls.py'\nfrom ravyn import Include\n\nroute_patterns = [\n    Include(namespace='myapp.accounts.urls', pattern='my_urls')\n]\n\n```\n\n```python title='src/app.py'\nfrom ravyn import Ravyn, Include\n\napp = Ravyn(routes=[Include('src.urls')])\n\n```\n\n## Run the application\n\nAs mentioned before, we recommend uvicorn for production but it's not mandatory.\n\n**Using uvicorn**:\n\n```shell\nuvicorn src:app --reload\n\nINFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)\nINFO:     Started reloader process [28720]\nINFO:     Started server process [28722]\nINFO:     Waiting for application startup.\nINFO:     Application startup complete.\n```\n\n## Run the application with custom settings\n\n**Using uvicorn**:\n\n```shell\nRAVYN_SETTINGS_MODULE=myapp.AppSettings uvicorn src:app --reload\n\nINFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)\nINFO:     Started reloader process [28720]\nINFO:     Started server process [28722]\nINFO:     Waiting for application startup.\nINFO:     Application startup complete.\n```\n\n## OpenAPI documentation\n\nRavyn also comes with OpenAPI docs integrated. For those used to that, this is roughly the same and to make it\nhappen, there were inspirations that helped Ravyn getting there fast.\n\nRavyn starts automatically the OpenAPI documentation by injecting the OpenAPIConfig default from\nthe settings and makes Swagger, ReDoc an Stoplight elements available to you out of the box.\n\nTo access the OpenAPI, simply start your local development and access:\n\n* **Swagger** - `/docs/swagger`.\n* **Redoc** - `/docs/redoc`.\n* **Stoplight Elements** - `/docs/elements`.\n\nThere are more details about [how to configure the OpenAPIConfig](https://ravyn.dev/configurations/openapi/config)\nwithin the documentation.\n\nThere is also a good explanation on how to use the [OpenAPIResponse](https://ravyn.dev/responses#openapi-responses)\nas well.\n\n## Notes\n\nThis is just a very high-level demonstration of how to start quickly and what Ravyn can do.\nThere are plenty more things you can do with Ravyn. Enjoy! \ud83d\ude0a\n\n## Sponsors\n\nCurrently there are no sponsors of Ravyn but you can financially help and support the author though\n[GitHub sponsors](https://github.com/sponsors/tarsil) and become a **Special one** or a **Legend**.\n\n### Powered by\n\nWorth mentioning who is helping us.\n\n**JetBrains**\n\n[![JetBrains logo.](https://resources.jetbrains.com/storage/products/company/brand/logos/jetbrains.svg)](https://jb.gg/OpenSourceSupport)\n\n[edgy_orm]: https://ravyn.dev/databases/edgy/motivation\n[mongoz_odm]: https://ravyn.dev/databases/mongoz/motivation\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Ravyn combines performance, type safety, and elegance. A next-generation async Python framework for APIs, microservices, and web applications.",
    "version": "0.1.0",
    "project_urls": {
        "Changelog": "https://ravyn.dymmond.com/release-notes/",
        "Documentation": "https://ravyn.dymmond.com/",
        "Funding": "https://github.com/sponsors/tarsil",
        "Homepage": "https://github.com/dymmond/ravyn",
        "Source": "https://github.com/dymmond/ravyn"
    },
    "split_keywords": [
        "ai",
        " aiohttp",
        " anyio",
        " aop",
        " api",
        " api-key",
        " api-server",
        " asgi",
        " async",
        " async-framework",
        " asyncio",
        " authentication",
        " auto-documentation",
        " autodoc",
        " backend",
        " background-tasks",
        " caching",
        " cloud-native",
        " concurrency",
        " controllers",
        " cors",
        " csrf",
        " data-validation",
        " dependency-injection",
        " developer-friendly",
        " django",
        " dymmond",
        " esmerald",
        " event-driven",
        " exception-handling",
        " fastapi",
        " flask",
        " graphql",
        " graphql-support",
        " high-performance",
        " http",
        " hypercorn",
        " interceptors",
        " json",
        " jwt",
        " lilya",
        " machine-learning",
        " microservices",
        " middlewares",
        " ml",
        " modern-python",
        " non-blocking",
        " oauth2",
        " observables",
        " openapi",
        " openapi-schema",
        " openapi3",
        " pydantic",
        " python",
        " python-types",
        " python3",
        " quart",
        " ravyn",
        " ravyn-framework",
        " redoc",
        " request-handling",
        " response-models",
        " rest",
        " rest-api",
        " routing",
        " security",
        " serialization",
        " sse",
        " starlette",
        " streaming",
        " swagger",
        " type-hints",
        " typed-api",
        " uvicorn",
        " validation",
        " web",
        " web-framework",
        " websocket",
        " websocket-server"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "32536d0a8d721a52e03ef9e9b74d7aae3cc31addcf45ffa4600b927af8ecf9be",
                "md5": "148aff0a4ee84e1c0049f74616043c6b",
                "sha256": "f49fcb9f9a8968a0835364bc398f83fd9c35c66f2f1d732bab12058640f0dbc9"
            },
            "downloads": -1,
            "filename": "ravyn-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "148aff0a4ee84e1c0049f74616043c6b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 362373,
            "upload_time": "2025-10-06T14:40:26",
            "upload_time_iso_8601": "2025-10-06T14:40:26.542607Z",
            "url": "https://files.pythonhosted.org/packages/32/53/6d0a8d721a52e03ef9e9b74d7aae3cc31addcf45ffa4600b927af8ecf9be/ravyn-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "782800d9c20809f229e88376b6fbc4220dae24efb8f321de139c33abb2fb5556",
                "md5": "a5ca5094593762de47d2bd7daecdb715",
                "sha256": "ee70de5f887177793218052895a7282b3b544e22f2cdd95f609aa7b78e9a3cce"
            },
            "downloads": -1,
            "filename": "ravyn-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "a5ca5094593762de47d2bd7daecdb715",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 246965,
            "upload_time": "2025-10-06T14:40:28",
            "upload_time_iso_8601": "2025-10-06T14:40:28.046443Z",
            "url": "https://files.pythonhosted.org/packages/78/28/00d9c20809f229e88376b6fbc4220dae24efb8f321de139c33abb2fb5556/ravyn-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-06 14:40:28",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "sponsors",
    "github_project": "tarsil",
    "github_not_found": true,
    "lcname": "ravyn"
}
        
Elapsed time: 1.13815s