Browse Source

[Python] Add const as an separated option in Robyn and add version without const (#7777)

* Added a benchmark test for the socketify.py Python/PyPy web framework

* removed alpine docker

* updated readme.md

* No need to manually add Date header anymore on Socketify.py

* updated socketify.py benchmark to use object factories to increase performance

* add object factory to app-python3.py in socketify

* [Python] Update socketify.py with ASGI and SSGI, add Falcon ASGI SSGI with socketify.py

* fix merge erros

* remove \n from plaintext in socketify.py-wsgi plaintext

* robyn
Ciro Spaciari 2 years ago
parent
commit
3e82b8e710

+ 25 - 0
frameworks/Python/robyn/app-const.py

@@ -0,0 +1,25 @@
+import multiprocessing
+import os
+
+from robyn import Robyn
+
+app = Robyn(__file__)
+
+
[email protected]('/plaintext', const=True)
+def plaintext() -> str:
+    return "Hello, world!"
+
+
+if __name__ == '__main__':
+    _is_travis = os.environ.get('TRAVIS') == 'true'
+
+    workers = multiprocessing.cpu_count() * 2 + 1
+    if _is_travis:
+        workers = 2
+
+    app.processes = workers
+    app.add_header("Server", "Robyn")
+    app.add_header("Content-Type", "text/plain")
+
+    app.start(url="0.0.0.0", port=8080)

+ 2 - 2
frameworks/Python/robyn/app.py

@@ -6,8 +6,8 @@ from robyn import Robyn
 app = Robyn(__file__)
 app = Robyn(__file__)
 
 
 
 
[email protected]('/plaintext', const=True)
-async def plaintext() -> str:
[email protected]('/plaintext')
+def plaintext() -> str:
     return "Hello, world!"
     return "Hello, world!"
 
 
 
 

+ 18 - 0
frameworks/Python/robyn/benchmark_config.json

@@ -18,6 +18,24 @@
         "notes": "",
         "notes": "",
         "versus": "None"
         "versus": "None"
       }
       }
+    },
+    {
+      "const": {
+        "plaintext_url": "/plaintext",
+        "port": 8080,
+        "approach": "Realistic",
+        "classification": "Micro",
+        "framework": "Robyn",
+        "language": "Python",
+        "flavor": "None",
+        "orm": "Raw",
+        "platform": "None",
+        "webserver": "None",
+        "os": "Linux",
+        "display_name": "Robyn [const]",
+        "notes": "",
+        "versus": "None"
+      }
     }
     }
   ]
   ]
 }
 }

+ 10 - 0
frameworks/Python/robyn/config.toml

@@ -10,3 +10,13 @@ orm = "Raw"
 platform = "None"
 platform = "None"
 webserver = "None"
 webserver = "None"
 versus = "None"
 versus = "None"
+
+[const]
+urls.plaintext = "/plaintext"
+approach = "Realistic"
+classification = "Micro"
+os = "Linux"
+orm = "Raw"
+platform = "None"
+webserver = "None"
+versus = "None"

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

@@ -0,0 +1 @@
+robyn==0.19.1

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

@@ -1 +1 @@
-robyn==0.17.5
+robyn==0.14.0

+ 11 - 0
frameworks/Python/robyn/robyn-const.dockerfile

@@ -0,0 +1,11 @@
+FROM python:3.9
+
+ADD ./ /robyn
+
+WORKDIR /robyn
+
+RUN pip3 install -r /robyn/requirements-const.txt
+
+EXPOSE 8080
+
+CMD ["python", "app-const.py"]