Skip to content
This repository was archived by the owner on Mar 24, 2026. It is now read-only.

Commit d556399

Browse files
committed
[Python] Update Robyn to v0.82.0
- Bump robyn from 0.45.0 to 0.82.0 (200% faster runtime) - Bump uvloop from 0.19.0 to 0.22.1 - Upgrade Docker base image from python:3.12 to python:3.13-slim - Use modern Robyn API: dict return for JSON instead of Response+jsonify - Remove unused imports (Response, jsonify, os) - Fix server header typo ("Roby1n" -> "Robyn") - Optimize const variant: cpu_count() workers with 1 process - Fix double bracket typo in const Dockerfile CMD Made-with: Cursor
1 parent b669efd commit d556399

File tree

6 files changed

+21
-33
lines changed

6 files changed

+21
-33
lines changed
Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
import multiprocessing
2-
import os
32

4-
from robyn import Response, Robyn, jsonify
3+
from robyn import Robyn
54
from robyn.argument_parser import Config
65

76

8-
class SpecialConfig(Config):
7+
class BenchConfig(Config):
98
def __init__(self):
109
super().__init__()
11-
self.workers = 2
12-
self.processes = (os.cpu_count() * 2) + 1
10+
self.workers = multiprocessing.cpu_count()
11+
self.processes = 1
1312
self.log_level = "WARN"
1413

1514

16-
app = Robyn(__file__, config=SpecialConfig())
15+
app = Robyn(__file__, config=BenchConfig())
1716

1817

1918
@app.get("/plaintext", const=True)
@@ -22,16 +21,10 @@ def plaintext() -> str:
2221

2322

2423
@app.get("/json", const=True)
25-
def json() -> str:
26-
return Response(
27-
status_code=200,
28-
description=jsonify({"message": "Hello, world!"}),
29-
headers={"Content-Type": "application/json"}
30-
)
31-
24+
def json() -> dict:
25+
return {"message": "Hello, world!"}
3226

3327

3428
if __name__ == "__main__":
3529
app.add_response_header("Server", "Robyn")
36-
3730
app.start(host="0.0.0.0", port=8080)

frameworks/Python/robyn/app.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
import multiprocessing
2-
import os
32

4-
from robyn import Response, Robyn, jsonify
3+
from robyn import Robyn
54
from robyn.argument_parser import Config
65

76

8-
class SpecialConfig(Config):
7+
class BenchConfig(Config):
98
def __init__(self):
109
super().__init__()
1110
self.workers = 2
12-
self.processes = (os.cpu_count() * 2) + 1
11+
self.processes = multiprocessing.cpu_count()
1312
self.log_level = "WARN"
1413

1514

16-
app = Robyn(__file__, config=SpecialConfig())
15+
app = Robyn(__file__, config=BenchConfig())
1716

1817

1918
@app.get("/plaintext")
@@ -22,14 +21,10 @@ def plaintext() -> str:
2221

2322

2423
@app.get("/json")
25-
def json() -> str:
26-
return Response(
27-
status_code=200,
28-
description=jsonify({"message": "Hello, world!"}),
29-
headers={"Content-Type": "application/json"}
30-
)
24+
def json() -> dict:
25+
return {"message": "Hello, world!"}
3126

3227

3328
if __name__ == "__main__":
34-
app.add_response_header("Server", "Roby1n")
29+
app.add_response_header("Server", "Robyn")
3530
app.start(host="0.0.0.0", port=8080)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
uvloop==0.19.0
2-
robyn==0.45.0
1+
uvloop==0.22.1
2+
robyn==0.82.0
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
uvloop==0.19.0
2-
robyn==0.45.0
1+
uvloop==0.22.1
2+
robyn==0.82.0
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.12
1+
FROM python:3.13-slim
22

33
ADD ./ /robyn
44

@@ -8,4 +8,4 @@ RUN pip3 install -r /robyn/requirements-const.txt
88

99
EXPOSE 8080
1010

11-
CMD ["python", "app-const.py", "--log-level", "warn"]]
11+
CMD ["python", "app-const.py", "--log-level", "warn"]

frameworks/Python/robyn/robyn.dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.12
1+
FROM python:3.13-slim
22

33
ADD ./ /robyn
44

0 commit comments

Comments
 (0)