Skip to content

Releases: sparckles/Robyn

v0.13.1 | Robyn installation fixed via conda-forge

20 Feb 01:33

Choose a tag to compare

No major functional changes. Only support changes.

You can use conda for installations:

conda install -c conda-forge robyn

What's Changed

Full Changelog: v0.13.0...v0.13.1

v0.13.0 - Middlewares!

15 Feb 23:39

Choose a tag to compare

Robyn now supports middlewares!!

Sample Usage

You can use both sync and async functions for middlewares!

@app.before_request("/")
async def hello_before_request(request):
    print(request)


@app.after_request("/")
def hello_after_request(request):
    print(request)

What's Changed

Full Changelog: v0.12.1...v0.13.0

v0.12.1 - Default url bug fix

13 Feb 17:01

Choose a tag to compare

What's Changed

Full Changelog: v0.12.0...v0.12.1

There was an error in the previous release that the app.start() function was defaulting to 128.0.0.1 instead of 127.0.0.1. This PR fixes it.

This release fixes it.

v0.12.0 - Events added

20 Jan 22:38

Choose a tag to compare

Robyn now supports startup and shutdown events and is now backed with a more stable build backend.

Sample Usage

You can either use the decorator syntax or the functional call syntax to organise your code.

async def startup_handler():
    logger.log(logging.INFO, "Starting up")
app.startup_handler(startup_handler)

@app.shutdown_handler
def shutdown_handler():
    logger.log(logging.INFO, "Shutting down")

What's Changed

Special Thanks

  • @klaa97 for making robyn's PR at TechEmpoweredBenchmark's repo!

Full Changelog: v0.11.1...v0.12.0

v0.11.1 - Make Robyn work with docker containers

11 Jan 23:09

Choose a tag to compare

This is a minor release. An input statement was being used instead of a print statement. This will help with docker containers and also Tech-Empowered benchmarking.

What's Changed

  • Use print instead of input after starting server by @klaa97 in #149

New Contributors

Full Changelog: v0.11.0...v0.11.1

Special thanks to @klaa97 for identifying the bug and fixing it! 🥳

v0.11.0 - Add support for query params across EVERY HTTP method and dev server fix

07 Jan 09:56

Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v0.10.0...v0.11.0

Summary

You can make a request to http://localhost:5000/query?a=b and can access the params in the following way:

@app.get("/query")
async def query_get(request):
    query_data = request["queries"]
    return jsonify(query_data)

The hot reloading server is now fixed and works on Linux and OSX(i.e. on all important operating systems). Windows support for dev server is still WIP.

Special thanks to @patchgamestudio for their contribution with the query params 🥳

v0.10.0 - Async Functions now supported in Web Sockets

20 Dec 09:12

Choose a tag to compare

The latest version of Robyn supports async functions in WebSockets now!

Usage

@websocket.on("message")
async def connect():
    global i
    i+=1
    if i==0:
        return "Whaaat??"
    elif i==1:
        return "Whooo??"
    elif i==2:
        return "*chika* *chika* Slim Shady."
    elif i==3:
        i= -1
        return ""

@websocket.on("close")
async def close():
    return "Goodbye world, from ws"

@websocket.on("connect")
async def message():
    return "Hello world, from ws"

Important Note:

Async functions execute out of order. i.e. They do not block the actor in order to provide concurrent execution. However, if the order is essential for you while using async functions, try using sync functions for now or wait for a future release :D

What's Changed

New Contributors

Full Changelog: v0.9.0...v0.10.0

Thanks

Thanks to @Kludex @awestlake87 @ShadowJonathan @shivaylamba @messense for their help(Issues/PRs) with this release. 😄

v0.9.0 | WebSockets

03 Dec 14:30

Choose a tag to compare

Websocket Intergration

PR Links

Full Changelog: v0.8.0...v0.9.0

Robyn supports WebSockets now.

from robyn import Robyn, WS

app = Robyn(__file__)
websocket = WS(app, "/web_socket")
i = -1

@websocket.on("message")
def connect():
    global i
    i+=1
    if i==0:
        return "Whaaat??"
    elif i==1:
        return "Whooo??"
    elif i==2:
        i = -1
        return "*chika* *chika* Slim Shady."
        
@websocket.on("close")
def close():
    print("Hello world")
    return "Hello world, from ws"

@websocket.on("connect")
def message():
    print("Hello world")
    return "Hello world, from ws"
        

You can have 3 methods for every web socket:

"message", "close" and "connect" for responding to the message received, connection closed and connection initiated.

v0.8.1 (Minor Bug fix)

17 Nov 23:01

Choose a tag to compare

What's Changed

Full Changelog: v0.8.0...v0.8.1

app.start(url='127.0.0.1') no longer defaults to 0.0.0.0 and the defaults are also set to their original value.

v0.8.0

10 Nov 21:58

Choose a tag to compare

The latest version of Robyn now scales across multiple cores!!

PR LInks

Full Changelog: https://github.com/sansyrox/robyn/blob/main/CHANGELOG.md#v080-2021-11-10

You can select the number of processes and workers now:

python3 app.py --workers=5 --processes=5

Performance Comparison [CPU under very heavy strain]

Robyn - 5 Processes and 5 Workers (v0.8.0)

╰─ oha -n 500000 -c 50 http://localhost:5000/ --no-tui                                                                                                                                                                                                                                        ─╯
Summary:
  Success rate:	1.0000
  Total:	74.1781 secs
  Slowest:	0.1318 secs
  Fastest:	0.0005 secs
  Average:	0.0074 secs
  Requests/sec:	6740.5379

  Total data:	21.93 MiB
  Size/request:	46 B
  Size/sec:	302.80 KiB

Response time histogram:
  0.002 [49062]  |■■■■■■■■■■■■■
  0.004 [115710] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  0.006 [105245] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  0.008 [72753]  |■■■■■■■■■■■■■■■■■■■■
  0.010 [54286]  |■■■■■■■■■■■■■■■
  0.012 [36697]  |■■■■■■■■■■
  0.014 [22683]  |■■■■■■
  0.016 [14015]  |■■■
  0.018 [8920]   |■■
  0.020 [5815]   |■
  0.022 [14814]  |■■■■

Latency distribution:
  10% in 0.0025 secs
  25% in 0.0037 secs
  50% in 0.0060 secs
  75% in 0.0095 secs
  90% in 0.0136 secs
  95% in 0.0171 secs
  99% in 0.0278 secs

Details (average, fastest, slowest):
  DNS+dialup:	0.0026 secs, 0.0022 secs, 0.0031 secs
  DNS-lookup:	0.0000 secs, 0.0000 secs, 0.0001 secs

Status code distribution:
  [200] 500000 responses

Robyn - 1 Process and 1 Worker (v0.7.1)

╰─ oha -n 500000 -c 50 http://localhost:5000/ --no-tui                                                                                                                                                                                                                                        ─╯
Summary:
  Success rate:	1.0000
  Total:	101.4573 secs
  Slowest:	0.0858 secs
  Fastest:	0.0011 secs
  Average:	0.0101 secs
  Requests/sec:	4928.1797

  Total data:	8.95 MiB
  Size/request:	18 B
  Size/sec:	90.37 KiB

Response time histogram:
  0.003 [617]    |
  0.005 [23214]  |■■■
  0.008 [151605] |■■■■■■■■■■■■■■■■■■■■■
  0.011 [228487] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  0.013 [55292]  |■■■■■■■
  0.016 [32058]  |■■■■
  0.019 [7509]   |■
  0.021 [747]    |
  0.024 [153]    |
  0.027 [52]     |
  0.029 [266]    |

Latency distribution:
  10% in 0.0075 secs
  25% in 0.0086 secs
  50% in 0.0097 secs
  75% in 0.0111 secs
  90% in 0.0138 secs
  95% in 0.0155 secs
  99% in 0.0178 secs

Details (average, fastest, slowest):
  DNS+dialup:	0.0034 secs, 0.0019 secs, 0.0043 secs
  DNS-lookup:	0.0001 secs, 0.0000 secs, 0.0011 secs

Status code distribution:
  [200] 500000 responses

Conclusion

It saves around 27 seconds under high strain conditions. The default configs are at 1 worker and 1 process. You can config for whatever works best for you.

Contributors

Special thanks to @JackThomson2 @messense @awestlake87 for the help with the socket sharing feature! 🥳 ✨