# README

## Vibora (Under heavy development)

[Vibora](https://vibora.io) is a **sexy and fast** hybrid (sync/async) Python 3.6+ web framework & server.

* Fast and efficient (probably the fastest Python web framework).
* Schemas / Validation engine. (15x faster than marshmallow)
* Template Engine (AOT compiler, smart cache/reloader, deep inheritance, 2x faster than Jinja2)
* Websockets (RFC 7118 / RFC 6455)
* Components / Nested Blueprints / Domain Based Routes
* Connection Reaper / Self-Healing Workers
* Sessions (encrypted cookies, Redis, Memcache, files)
* Download / Upload streaming
* MultipartForm streaming (Cython finite state machine)
* Caching tools (go fast or go home)
* Complete flow customization (A.k.a Middlewares / Signals / Listeners / Black Magic)
* Static Files (Smart Cache, Range, LastModified, ETags, Streaming)
* Complete Test Framework (async & websocket included)
* Type hints, type hints everywhere.

## Goals

* **Be the fastest Python web framework**.&#x20;
* Windows / Linux / MacOS.
* Correctness > Performance > Easiness of Use > Framework Maintenance.
* Server and Framework, one soul.
* Enjoyable development environment.&#x20;
* Provide a modern Flask alternative to the community.&#x20;

## Usage Example

```python
import asyncio
from vibora import Vibora
from vibora.request import Request
from vibora.responses import JsonResponse

app = Vibora()


@app.route('/')
def home():
    return JsonResponse({'hello': 'world'})


@app.route('/async', methods=['GET'])
async def home_async(request: Request):
    await asyncio.sleep(1)
    print(request.headers)
    return JsonResponse({'hello': 'world'}, status_code=201)


if __name__ == '__main__':
    app.run()
```

## FixME

* Logs
* Router Host/Subdomains
* Async requests timeout.
* Implement a faster, correct and tested router.&#x20;
* Remove requests dependency
* Pause Writing big templates
* Streaming
* Improve URL FOR
* Tests
* Verify compile warnings by messing up any extension path on setup.py
* Check on big uploads
* Command line tools
* Websockets

## Roadmap

* HTTP2 Support.
* Rate Limiting (AWS & Ip Tables integration to help with DDOS)&#x20;
* Cluster-Wide publish/subscribe events API.
* Near real-time API with statistics about the server.
* Native i18n support.
* Auto Reloading
* JIT compiler for user routes.
* Authentication/Authorization Framework

## Special Thanks

* Armin Ronacher. No words needed, this whole framework is based on many of his projects.
* Cython developers. Crazy stuff. Awesome work.&#x20;
* Paweł Piotr Przeradowski. Japronto inspired a lot this framework, thanks bro!

## FAQ

* **Where the performance comes from** ?
  * Cython. Critical framework pieces are written Cython so it can leverage C speed in critical stuff.
  * Common tasks as template rendering, schema validation were made builtin in the framework,&#x20;

    written from scratch with performance in mind.  &#x20;
* **It's Pypy compatible** ?
  * Not yet. But I'll make sure it works on Pypy as soon as Pypy reaches 3.5 stable.
* **Why not use Jinja2** ?
  * It's hell easier to write something from scratch when looking for performance on something&#x20;

    already heavily optimized.
* **Where is Japronto on benchmarks** ?
  * Japronto is a proof of concept. The whole framework is missing a huge chunk of features and fixes.&#x20;

    The author of the framework does not encourage the usage of it and so do I.&#x20;
  * Japronto can be faster than Vibora on naked benchmarks thanks to impressive hand-coded C&#x20;

    and faster HTTP parser (pico X noyent).
  * Vibora does not use "picohttparser" because I don't think it's safe enough and there are bunch of issues/pull&#x20;

    requests waiting years to be fixed.
  * Hand-coded C extensions can be a nightmare hell to non-expert C devs so I'm not&#x20;

    willing to replace Cython with baby cared C code. Still I'm willing to replace Cython with Rust extensions&#x20;

    if they get stable enough.
  * Compare a naked framework against a fully featured framework is just dumb. To give you a reason:&#x20;

    Vibora was 30% faster before security and features were a concern.&#x20;
* **Why don't export the template engine into a new project** ?
  * I'm planning to do so but right now I want to focus on Vibora features/integration.   &#x20;
* **Can we make it even faster** ?
  * Sure! I have a hell bunch of ideas but I'm one man army. Are you willing to help me ? :)
