GithubHelp home page GithubHelp logo

sparckles / robyn Goto Github PK

View Code? Open in Web Editor NEW
3.6K 28.0 180.0 7.26 MB

Robyn is a Super Fast Async Python Web Framework with a Rust runtime.

Home Page: https://robyn.tech/

License: BSD 2-Clause "Simplified" License

Python 41.65% Rust 23.45% HTML 0.21% Shell 0.71% JavaScript 30.39% CSS 2.96% Dockerfile 0.62%
rust python python3 backend async hacktoberfest http-server web

robyn's People

Contributors

abdur-rahmaanj avatar antoinerr avatar carlosm27 avatar cclauss avatar dependabot[bot] avatar elliotwaite avatar guilefoylegaurav avatar hougesen avatar idokendo avatar jackthomson2 avatar jeasoft avatar klaa97 avatar kludex avatar madhavajay avatar mikaeelghr avatar mirecl avatar mr-sunglasses avatar noborita9 avatar oluwaseun241 avatar orvil1026 avatar parths007 avatar patrick91 avatar pre-commit-ci[bot] avatar rachfop avatar sansyrox avatar shending-help avatar shivaylamba avatar suhailmalik07 avatar urjitbhatia avatar yednapg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

robyn's Issues

Add actix router

Now we need to integrate actix router to parse the routes correctly.

ASGI Implementation

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

  • Robyn will be an ASGI compliant and the dev can use an external ASGI if they want to. Although, the inbuilt SGI will be good enough maybe even better ๐Ÿ‘€

Maintenance issue

Integrate a github action for

  • Creating releases on github
  • Generating changelog
  • issue templates
  • pr templates
  • travis testing pipeline

Add better docs
and code the homepage that you(Sanskar) have in mind.

Add fixtures in testing

Instead of depending on two docker compose services, start the other Python services using fixtures.

Modularise code

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.

Enable hot reloading by default

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.

Mini Roadmap | A list of issues that would require fixing

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.

Away with limited internet access till 1st August

Discussed in #50

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! ๐Ÿ––

Add doc stings

Most of the functions are without any doc strings.
Add verbosity!

Set MIME types when handling different types of medias

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.

For 0.8.x

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.

QPS drops drastically after processing many requests

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

For v0.7.0

  • Improve the docs!
  • Add Python Tests!!!
  • Modularise code
  • Add a performance comparison with other frameworks
  • Reveal the logo
  • (Maybe) add docs for plugin creation. (Push to 0.8)
  • Integrate actix router (Push to 0.8)
  • Create the homepage
  • Make request object accessible across all the routes
  • Make headers accessible in every route
  • Integrate circle ci testing
  • Add rust tests
  • Make the server ready for HTTP 1.1
  • Add the option of 0.0.0.0
  • Add python tests

Add the support to serve static directories

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.

Add PyPi Metadata

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',
  ],
)

[Proposal] Const Requests

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.

Error on import

image

Error while running test.py. Did you forget adding files ?
Note: already cloned the repo, and also did pip install robyn

Improve the router

Improve the router. Add the ability to have variable parameters in the routes.

  • Consider if we need to use a regex based router | as ripgrep is very fast
  • Or we need to use a vanilla stack based router
  • Or we need to go all fancy and implement a radix tree (or something similar) ourselves!

Add tests!

No tests atm. Add tests for Python and Rust.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.