sparckles / robyn Goto Github PK
View Code? Open in Web Editor NEWRobyn is a Super Fast Async Python Web Framework with a Rust runtime.
Home Page: https://robyn.tech/
License: BSD 2-Clause "Simplified" License
Robyn is a Super Fast Async Python Web Framework with a Rust runtime.
Home Page: https://robyn.tech/
License: BSD 2-Clause "Simplified" License
I think I may know a way to do that.
Explore the possibility to do that.
Return a request
object instead of just a body.
The object will contain , body/data, headers , etc.
Robyn will follow the PEP guidelines required to confirm to ASGI specifications.
What this means is that the user/developer will still have the ability to use their preference of ASGI server in front of the framework.
Having said that, most *sgis are written in CPython and they are theoretically slower than their rust counterpart. Robyn will focus on speed and that's why Robyn will also ship with a server implementation. This server will also act as an ASGI but being coupled with Robyn will prioritise Robyn and hence is not being shipped as another ASGI written in rust.
If I ever feel that I am maintaining two projects(SGI and a framework) instead of one(just robyn) we would create two separate projects. Otherwise, if there comes another SGI in the future that is written in Rust or faster than my implementation, we will kill the SGI in Robyn.
TL;DR
Github builds are failing. Maybe the latest version will fix this.
Add a flag that allows hot reloading of web server.
Now we need to integrate actix router to parse the routes correctly.
This will create an issue with the release of OSX versions.
Need to fix this.
Try to create a way to mount directory
Using the hello world example from README.md, and benchmark it with oha
1st round
โฏ oha -n 10000 http://localhost:5000
Summary:
Success rate: 0.8308
Total: 1.2192 secs
Slowest: 0.1544 secs
Fastest: 0.0028 secs
Average: 0.0073 secs
Requests/sec: 8202.1065
Total data: 105.47 KiB
Size/request: 13 B
Size/sec: 86.51 KiB
Response time histogram:
0.002 [68] |
0.003 [4340] |โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ
0.005 [2943] |โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ
0.007 [754] |โ โ โ โ โ
0.009 [149] |โ
0.010 [4] |
0.012 [0] |
0.014 [0] |
0.016 [0] |
0.017 [0] |
0.019 [50] |
Latency distribution:
10% in 0.0051 secs
25% in 0.0055 secs
50% in 0.0062 secs
75% in 0.0071 secs
90% in 0.0082 secs
95% in 0.0089 secs
99% in 0.0106 secs
Details (average, fastest, slowest):
DNS+dialup: 0.0035 secs, 0.0002 secs, 0.1505 secs
DNS-lookup: 0.0000 secs, 0.0000 secs, 0.0002 secs
Status code distribution:
[200] 8308 responses
Error distribution:
[1600] connection closed before message completed
[92] operation was canceled: connection closed
2nd round
โฏ oha -n 10000 http://localhost:5000
Summary:
Success rate: 0.8167
Total: 7.3648 secs
Slowest: 0.1063 secs
Fastest: 0.0006 secs
Average: 0.0070 secs
Requests/sec: 1327.3908
Total data: 101.36 KiB
Size/request: 13 B
Size/sec: 13.76 KiB
Response time histogram:
0.002 [29] |
0.004 [47] |
0.006 [3783] |โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ
0.007 [3249] |โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ
0.009 [771] |โ โ โ โ โ โ
0.011 [52] |
0.013 [5] |
0.015 [0] |
0.017 [0] |
0.018 [0] |
0.020 [48] |
Latency distribution:
10% in 0.0050 secs
25% in 0.0055 secs
50% in 0.0062 secs
75% in 0.0071 secs
90% in 0.0081 secs
95% in 0.0087 secs
99% in 0.0102 secs
Details (average, fastest, slowest):
DNS+dialup: 0.0034 secs, 0.0002 secs, 0.1020 secs
DNS-lookup: 0.0000 secs, 0.0000 secs, 0.0001 secs
Status code distribution:
[200] 7984 responses
Error distribution:
[1719] connection closed before message completed
[73] operation was canceled: connection closed
3rd round
โฏ oha -n 10000 http://localhost:5000
Summary:
Success rate: 0.8108
Total: 8.9002 secs
Slowest: 0.0075 secs
Fastest: 0.0009 secs
Average: 0.0047 secs
Requests/sec: 8.3144
Total data: 780 B
Size/request: 13 B
Size/sec: 87 B
Response time histogram:
0.001 [3] |โ โ โ โ โ โ โ
0.001 [7] |โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ
0.002 [4] |โ โ โ โ โ โ โ โ โ
0.002 [1] |โ โ
0.003 [10] |โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ
0.004 [4] |โ โ โ โ โ โ โ โ โ
0.004 [2] |โ โ โ โ
0.005 [2] |โ โ โ โ
0.005 [6] |โ โ โ โ โ โ โ โ โ โ โ โ โ โ
0.006 [13] |โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ
0.007 [8] |โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ
Latency distribution:
10% in 0.0019 secs
25% in 0.0034 secs
50% in 0.0049 secs
75% in 0.0065 secs
90% in 0.0070 secs
95% in 0.0071 secs
99% in 0.0075 secs
Details (average, fastest, slowest):
DNS+dialup: 0.0022 secs, 0.0002 secs, 0.0040 secs
DNS-lookup: 0.0000 secs, 0.0000 secs, 0.0002 secs
Status code distribution:
[200] 60 responses
Error distribution:
[13] connection closed before message completed
[1] operation was canceled: connection closed
Use better pre built libraries instead of manually checking for GET, POST, etc.
I have been using the --dev=true flag a lot more than the prod build.
It makes sense in my opinion to enable the reload mode by default and have the developer disable it while deploying.
I can trace back to this issue: 08dbb14
Make the readme prettier
Right now we can serve static files but now we should add the ability to serve static folders/directories.
This way we can add support to build folders of famous front end frameworks.
Try reading the documentation of this : https://crates.io/crates/httparse
Most of the functions are without any doc strings.
Add verbosity!
Instead of depending on two docker compose services, start the other Python services using fixtures.
Maybe this version will be called version 1.x.x, but it doesn't really matter at the moment.
I would want to focus on web socket integration after HTTP 1.1 integration.
I will be reading more about it and try to implement that.
Integrate a github action for
Add better docs
and code the homepage that you(Sanskar) have in mind.
Make a new release with the updated docs and add #64 before making a release!
Integrate support for the Pytest files.
Try to modularise code.
The current code is smelling a bit and is giving off monkey patch vibes.
Try splitting it into a more organised file structure. Considering the inclusion of tests.
Under the Contributor guideline section, the link for architecture redirects to raw content. It should redirect to
https://github.com/sansyrox/robyn/blob/main/docs/architecture.md
Issue section:
https://github.com/sansyrox/robyn#contributor-guidelines
No tests atm. Add tests for Python and Rust.
Originally posted by sansyrox July 16, 2021
Hey Everyone! ๐
I will starting my first job soon and will be moving away from my family for the first time in 22 years(my age jic)!! So, I have decided to spend some quality time with the family and I will be away for the the next 15 days without/with limited internet access.
I really appreciate all your contributions and am delighted to work with you all โค๏ธ However, I won't be very active till 1st August.
I will still have some limited access, so, if anything urgent comes up , you can send me an email with "URGENT" (all caps) in the subject line or you can open an issue here with "URGENT" in the title.
I hope y'all understand this. Can't wait to be back working on this amazing project. ๐ฅ
May the FOSS be with you! ๐
https://docs.rs/reqwest/0.11.4/reqwest/
Async requests in python are very verbose. (3-4 lines for a single await)
Make a way to add easier requests in robyn!
Add "HTTP server" around the docs a bit more? Just referring to it as "a framework" or "backend" isn't very descriptive
From here: https://www.reddit.com/user/tunisia3507/
from distutils.core import setup
setup(
name = 'YOURPACKAGENAME', # How you named your package folder (MyLib)
packages = ['YOURPACKAGENAME'], # Chose the same as "name"
version = '0.1', # Start with a small number and increase it with every change you make
license='MIT', # Chose a license from here: https://help.github.com/articles/licensing-a-repository
description = 'TYPE YOUR DESCRIPTION HERE', # Give a short description about your library
author = 'YOUR NAME', # Type in your name
author_email = '[email protected]', # Type in your E-Mail
url = 'https://github.com/user/reponame', # Provide either the link to your github or to your website
download_url = 'https://github.com/user/reponame/archive/v_01.tar.gz', # I explain this later on
keywords = ['SOME', 'MEANINGFULL', 'KEYWORDS'], # Keywords that define your package best
install_requires=[ # I get to this in a second
'validators',
'beautifulsoup4',
],
classifiers=[
'Development Status :: 3 - Alpha', # Chose either "3 - Alpha", "4 - Beta" or "5 - Production/Stable" as the current state of your package
'Intended Audience :: Developers', # Define that your audience are developers
'Topic :: Software Development :: Build Tools',
'License :: OSI Approved :: MIT License', # Again, pick a license
'Programming Language :: Python :: 3', #Specify which pyhton versions that you want to support
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
],
)
Once we decide the kind of router we want to use, we should also consider adding caching to it.
Need to fix the following
several un-needed dependencies (hyper, serde, serde_json, async-trait, log, async-channel)
The use of both async-std and tokio doesn't really make sense, combined with another thread pool the setup seems in-efficient.
Remove the use of blocking sockets
The server only accepts another connection after the previously accepted connection has been read from, this will cause SIGNIFICANT performance issues especially if a client is slow at sending data.
Server doesn't actually support multiple requests on the same connection, which breaks any use in the real world because 1 connection can send many requests.
Server assumes that all content returned from the framework will be a string, which in reality should be Bytes because there is no guarantee in the HTTP world that the response must be UTF-8. || Add support for JSON and other types
Server only reads 1024 bytes of data from the socket when you first accept it, at least from what I can see. This means that if the request size is greater than 1024 the next request to go through that connection will be invalid in all likely hood.
The server doesn't check if the actual HTTP request itself is valid, it just assumes that if it contains GET, POST, etc... That it's valid meaning you could have a POST request contain GET in the body and the server would treat it like a GET.
No HTTP header handling, you simply assume the response from python will only be the body, which creates issues if you want to set any kind of headers or some other status code.
If the client disconnects from the connection early, Python call fails, or and conversion fails the server will panic, and depending on where that happens it can cause the entire server to just shut down.
Issue:
At present, our application does not include MIME types in the HTTP responses. The lack of MIME types can potentially lead to certain issues such as client applications not being able to correctly interpret the content received from our server. This could affect the overall user experience and could even result in security vulnerabilities if not properly addressed.
Expected Behavior:
When our server sends out a response, it should include the correct MIME type in the Content-Type header field. This way, the client applications will know how to interpret the received data.
Consider looking at the implementation of https://docs.rs/route-recognizer/0.3.0/route_recognizer/
They have a very good implementation of handling routes.
Replace 127.0.0.1 with 0.0.0.0 in the server file.
Add this ability in the app.start()
method.
Improve the router. Add the ability to have variable parameters in the routes.
We should experiment with ways to speed this up
I wonder if we should off an option for a constant response which won't change, this would allow us to never touch python for ultra fast path solutions.
https://github.com/sansyrox/robyn/pull/20#issuecomment-865121079
Read discussion above
And see if introducing a threadpool will impact asgi compliance(most probably not) but still check again.
Right now body can only be added to POST in robyn.
Add the feature to add the support for the other two as well.
The app is not responding on lossy utf. Fix it!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.