Hello, Robyn!
What is Robyn?
Robyn is a fast, high-performance Python web framework with a Rust runtime. It has been designed to provide near-native Rust throughput while benefiting from the code being written in Python. Robyn is comparable to other products such as Flask, FastAPI, Django, and a web server of choice. One of the key advantages of Robyn is that it does not require an external web server for production, making it more efficient and streamlined.
🤔 Why another web framework?
Since all other/popular Python frameworks are written in Python or CPython, which is not concurrency-friendly due to the notorious GIL and slow execution speed. Robyn, with a Rust runtime and a connected web server, attempts to move around the GIL in order to improve runtime performance in various ways. While having a decoupled web server has several advantages, Robyn's incorporated web server gives us greater control over the performance execution.
Performance Benchmarks(on a dual core machine)
You can read the detailed version on the docs website.
Total Time(seconds) | Slowest(seconds) | Fastest(seconds) | Average(seconds) | Requests/sec | |
---|---|---|---|---|---|
Flask(Gunicorn) | 5.5254 | 0.0784 | 0.0028 | 0.0275 | 1809.8082 |
FastAPI(API) | 4.1314 | 0.0733 | 0.0027 | 0.0206 | 2420.4851 |
Django(Gunicorn) | 13.5070 | 0.3635 | 0.0249 | 0.0674 | 740.3558 |
Robyn(1 process and 1 worker) | 1.8324 | 0.0269 | 0.0024 | 0.0091 | 5457.2339 |
Robyn(5 processes and 5 workers) | 1.5592 | 0.0211 | 0.0017 | 0.0078 | 6413.6480 |
⚡️ Current features
- Actively being developed!
- Written in Rust, btw xD
- A multithreaded Runtime
- Extensible
- A simple API
- Sync and Async Function Support
- Dynamic URL Routing
- Multi Core Scaling
- WebSockets!
- Hot Reloading
- Middlewares(Coming very soon!)
- Community First and truly FOSS!
🔮 Future Roadmap
- Add typing support
- Document the process of plugin creation
- Create some plugins(e.g. for various Database providers like PgSQL, Mongo,etc.)
- Increase the execution speed.
- Improve documentation
- Most Importantly, invest a lot of time in building the community and ecosystem around Robyn
👣 An overview of Robyn’s history
It was April of 2021, and I was in my final year of university. My project's deadline was fast approaching, and like any other hardworking student, I was spending all my time on Reddit. During that period, Rewrite in Rust memes were flooding Reddit’s CS threads. Being such a hardworking student, I was working on a completely unrelated separate project that used the flask backend. Also, having written some backends in Node.Js from time to time, I really missed Async methods while coding in Flask. So I thought to myself, you know Sanskar, what would be cool? If I were able to create an Async Flask! (At that time, I was already aware of FastAPI, but probably due to extreme delirium (I was a university senior) I probably didn't remember it), but what would have been cooler is IF IT WOULD BE WRITTEN IN RUST, BTW!! And this is how Robyn was born.
Acknowledgements
A huge thank you goes out to everyone who contributed to the development of Robyn. From creating libraries over which Robyn is built to assisting me with Rust queries and contributing and reviewing code. Thank you all so much for your help and support with the project. 💖
Conclusion
It's no secret that the Python ecosystem is constantly trying to improve the performance of runtime code. Robyn is a Python project used to ensure that our code runs smoothly and quickly. Our team is devoted to making Robyn the best experience possible for our users. We always welcome new contributors, and we encourage you to contribute to the project. Also, if you liked the project, please consider us a star on GitHub for increased visibility.