Browse Source

chore: update robyn to latest version (#9217)

* chore: update robyn to latest version

* update v number
Sanskar Jethi 11 months ago
parent
commit
404f8899ab

+ 7 - 11
frameworks/Python/robyn/app-const.py

@@ -1,15 +1,15 @@
 import multiprocessing
 import multiprocessing
 import os
 import os
 
 
-from robyn import Response, Robyn, jsonify
+from robyn import Response, Robyn
 from robyn.argument_parser import Config
 from robyn.argument_parser import Config
 
 
 
 
 class SpecialConfig(Config):
 class SpecialConfig(Config):
     def __init__(self):
     def __init__(self):
         super().__init__()
         super().__init__()
-        self.workers = 2
-        self.processes = (os.cpu_count() * 2) + 1
+        self.workers = (os.cpu_count() * 2) + 1
+        self.processes = os.cpu_count()
         self.log_level = "WARN"
         self.log_level = "WARN"
 
 
 
 
@@ -22,16 +22,12 @@ def plaintext() -> str:
 
 
 
 
 @app.get("/json", const=True)
 @app.get("/json", const=True)
-def json() -> str:
-    return Response(
-        status_code=200,
-        description=jsonify({"message": "Hello, world!"}),
-        headers={"Content-Type": "application/json"}
-        )
-
+def json() -> dict:
+    return {
+        "message": "Hello, world!"
+    }
 
 
 
 
 if __name__ == "__main__":
 if __name__ == "__main__":
     app.add_response_header("Server", "Robyn")
     app.add_response_header("Server", "Robyn")
-
     app.start(host="0.0.0.0", port=8080)
     app.start(host="0.0.0.0", port=8080)

+ 7 - 10
frameworks/Python/robyn/app.py

@@ -1,15 +1,15 @@
 import multiprocessing
 import multiprocessing
 import os
 import os
 
 
-from robyn import Response, Robyn, jsonify
+from robyn import Response, Robyn
 from robyn.argument_parser import Config
 from robyn.argument_parser import Config
 
 
 
 
 class SpecialConfig(Config):
 class SpecialConfig(Config):
     def __init__(self):
     def __init__(self):
         super().__init__()
         super().__init__()
-        self.workers = 2
-        self.processes = (os.cpu_count() * 2) + 1
+        self.workers = (os.cpu_count() * 2) + 1
+        self.processes = os.cpu_count()
         self.log_level = "WARN"
         self.log_level = "WARN"
 
 
 
 
@@ -22,13 +22,10 @@ def plaintext() -> str:
 
 
 
 
 @app.get("/json")
 @app.get("/json")
-def json() -> str:
-    return Response(
-        status_code=200,
-        description=jsonify({"message": "Hello, world!"}),
-        headers={"Content-Type": "application/json"}
-        )
-
+def json() -> dict:
+    return {
+        "message": "Hello, world!"
+    }
 
 
 if __name__ == "__main__":
 if __name__ == "__main__":
     app.add_response_header("Server", "Roby1n")
     app.add_response_header("Server", "Roby1n")

+ 2 - 1
frameworks/Python/robyn/benchmark_config.json

@@ -38,4 +38,5 @@
       }
       }
     }
     }
   ]
   ]
-}
+}
+

+ 1 - 1
frameworks/Python/robyn/requirements-const.txt

@@ -1,2 +1,2 @@
 uvloop==0.19.0
 uvloop==0.19.0
-robyn==0.45.0
+robyn==0.60.2

+ 1 - 1
frameworks/Python/robyn/requirements.txt

@@ -1,2 +1,2 @@
 uvloop==0.19.0
 uvloop==0.19.0
-robyn==0.45.0
+robyn==0.60.2

+ 1 - 1
frameworks/Python/robyn/robyn-const.dockerfile

@@ -8,4 +8,4 @@ RUN pip3 install -r /robyn/requirements-const.txt
 
 
 EXPOSE 8080
 EXPOSE 8080
 
 
-CMD ["python", "app-const.py", "--log-level", "warn"]]
+CMD ["robyn", "app-const.py", "--fast"]

+ 1 - 1
frameworks/Python/robyn/robyn.dockerfile

@@ -8,4 +8,4 @@ RUN pip3 install -r /robyn/requirements.txt
 
 
 EXPOSE 8080
 EXPOSE 8080
 
 
-CMD ["python", "app.py", "--log-level", "warn"]
+CMD ["robyn", "app.py", "--fast"]