George Sakkis 7 éve
szülő
commit
15dec7b95f

+ 1 - 0
.travis.yml

@@ -162,6 +162,7 @@ env:
     - "TESTDIR=Python/falcon"
     - "TESTDIR=Python/flask"
     - "TESTDIR=Python/historical"
+    - "TESTDIR=Python/japronto"
     - "TESTDIR=Python/klein"
     - "TESTDIR=Python/morepath"
     - "TESTDIR=Python/pyramid"

+ 21 - 0
frameworks/Python/japronto/README.md

@@ -0,0 +1,21 @@
+# Japronto Benchmark Test
+
+This is the Japronto portion of a [benchmarking tests suite](../../)
+comparing a variety of web development platforms.
+
+The information below is specific to Japronto. For further guidance,
+review the [documentation](http://frameworkbenchmarks.readthedocs.org/en/latest/).
+Also note that there is additional information provided in
+the [Python README](../).
+
+## Description
+
+[Japronto](https://github.com/squeaky-pl/japronto) is a screaming-fast, scalable,
+asynchronous Python 3.5+ HTTP toolkit.
+
+## Test Paths & Sources
+
+All of the test implementations are located within a single file ([app.py](app.py)).
+
+* [JSON Serialization](app.py): "/json"
+* [Plaintext](app.py): "/plaintext"

+ 36 - 0
frameworks/Python/japronto/app.py

@@ -0,0 +1,36 @@
+import multiprocessing
+from wsgiref.handlers import format_date_time
+import japronto
+import ujson as json
+
+
+def get_headers():
+    return {
+        'Server': 'Japronto/0.1.1',
+        'Date': format_date_time(None),
+    }
+
+
+def json_view(request):
+    return request.Response(
+        text=json.dumps({'message': 'Hello, world!'}),
+        mime_type='application/json',
+        headers=get_headers(),
+    )
+
+
+def plaintext_view(request):
+    return request.Response(
+        body=b'Hello, world!',
+        mime_type='text/plain',
+        headers=get_headers(),
+    )
+
+
+app = japronto.Application()
+app.router.add_route('/json', json_view, 'GET')
+app.router.add_route('/plaintext', plaintext_view, 'GET')
+
+
+if __name__ == '__main__':
+    app.run('0.0.0.0', 8080, worker_num=multiprocessing.cpu_count())

+ 24 - 0
frameworks/Python/japronto/benchmark_config.json

@@ -0,0 +1,24 @@
+{
+  "framework": "japronto",
+  "tests": [{
+    "default": {
+      "setup_file": "setup",
+      "json_url": "/json",
+      "plaintext_url": "/plaintext",
+      "port": 8080,
+      "approach": "Realistic",
+      "classification": "Micro",
+      "framework": "japronto",
+      "language": "Python",
+      "flavor": "Python3",
+      "platform": "None",
+      "webserver": "None",
+      "os": "Linux",
+      "orm": "Raw",
+      "database_os": "Linux",
+      "database": "None",
+      "display_name": "Japronto",
+      "notes": ""
+    }
+  }]
+}

+ 2 - 0
frameworks/Python/japronto/requirements.txt

@@ -0,0 +1,2 @@
+git+https://github.com/squeaky-pl/japronto.git#egg=japronto
+ujson==1.35

+ 7 - 0
frameworks/Python/japronto/setup.sh

@@ -0,0 +1,7 @@
+#!/bin/bash
+
+fw_depends python3
+
+pip3 install --install-option="--prefix=${PY3_ROOT}" -r $TROOT/requirements.txt
+
+python3 app.py &