diff --git a/frameworks/Python/morepath/README.md b/frameworks/Python/morepath/README.md deleted file mode 100644 index 3d0066a6f32..00000000000 --- a/frameworks/Python/morepath/README.md +++ /dev/null @@ -1,50 +0,0 @@ -# [Morepath](http://morepath.readthedocs.io/) Benchmark Test - -The information below is specific to Morepath. For further guidance, -review the [documentation](https://github.com/TechEmpower/FrameworkBenchmarks/wiki). -Also note that there is additional information that's provided in -the [Python README](../). - -This is the Python Morepath portion of a [benchmarking tests suite](../../) -comparing a variety of frameworks. - -All test implementations are located within ([./app](app)). - -## Description - -Morepath with [PonyOrm](https://docs.ponyorm.com/) using PostgreSQL for -database access. - -### Database - -PostgreSQL (with PonyORM). - -### Server - -gunicorn + meinheld on CPython - -## Test URLs - -### Test 1: JSON Encoding - - http://localhost:8080/json - -### Test 2: Single Row Query - - http://localhost:8080/db - -### Test 3: Multi Row Query - - http://localhost:8080/queries?queries=20 - -### Test 4: Fortunes (Template rendering) - - http://localhost:8080/fortunes - -### Test 5: Update Query - - http://localhost:8080/updates?queries=20 - -### Test 6: Plaintext - - http://localhost:8080/plaintext diff --git a/frameworks/Python/morepath/app/__init__.py b/frameworks/Python/morepath/app/__init__.py deleted file mode 100644 index b601c11a64a..00000000000 --- a/frameworks/Python/morepath/app/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -# flake8: noqa - -from app.app import App diff --git a/frameworks/Python/morepath/app/app.py b/frameworks/Python/morepath/app/app.py deleted file mode 100644 index 7b43a7baf51..00000000000 --- a/frameworks/Python/morepath/app/app.py +++ /dev/null @@ -1,11 +0,0 @@ -from more.pony import PonyApp -from more.jinja2 import Jinja2App - - -class App(PonyApp, Jinja2App): - pass - - -@App.template_directory() -def get_template_directory(): - return 'templates' diff --git a/frameworks/Python/morepath/app/collection.py b/frameworks/Python/morepath/app/collection.py deleted file mode 100644 index 8ab02a095f8..00000000000 --- a/frameworks/Python/morepath/app/collection.py +++ /dev/null @@ -1,6 +0,0 @@ -from .model import Fortune - - -class FortuneCollection(object): - def query(self): - return Fortune.select() diff --git a/frameworks/Python/morepath/app/model.py b/frameworks/Python/morepath/app/model.py deleted file mode 100644 index 9cd7bc8ed49..00000000000 --- a/frameworks/Python/morepath/app/model.py +++ /dev/null @@ -1,29 +0,0 @@ -from pony.orm import Database, Optional - -db = Database() - - -class Json(): - pass - - -class World(db.Entity): - randomnumber = Optional(int) - - -class WorldQueries(): - def __init__(self, queries): - self.queries = queries - - -class Fortune(db.Entity): - message = Optional(str) - - -class WorldUpdates(): - def __init__(self, queries): - self.queries = queries - - -class Plaintext(): - pass diff --git a/frameworks/Python/morepath/app/path.py b/frameworks/Python/morepath/app/path.py deleted file mode 100644 index 05d1dc442e1..00000000000 --- a/frameworks/Python/morepath/app/path.py +++ /dev/null @@ -1,35 +0,0 @@ -from random import randint - -from .app import App -from .model import Json, World, WorldQueries, WorldUpdates, Plaintext -from .collection import FortuneCollection - - -@App.path(model=Json, path='json') -def get_json(): - return Json() - - -@App.path(model=World, path='db') -def get_random_world(): - return World[randint(1, 10000)] - - -@App.path(model=WorldQueries, path='queries') -def get_queries(queries): - return WorldQueries(queries) - - -@App.path(model=FortuneCollection, path='fortunes') -def get_fortunes(): - return FortuneCollection() - - -@App.path(model=WorldUpdates, path='updates') -def get_updates(queries): - return WorldUpdates(queries) - - -@App.path(model=Plaintext, path='plaintext') -def get_plaintext(): - return Plaintext() diff --git a/frameworks/Python/morepath/app/run.py b/frameworks/Python/morepath/app/run.py deleted file mode 100644 index 82336adbb79..00000000000 --- a/frameworks/Python/morepath/app/run.py +++ /dev/null @@ -1,31 +0,0 @@ -import os - -import morepath - -from app import App -from .model import db - - -def setup_db(): - DBHOST = 'tfb-database' - - db.bind( - 'postgres', - user='benchmarkdbuser', - password='benchmarkdbpass', - host=DBHOST, - database='hello_world' - ) - db.generate_mapping(create_tables=True) - - -def wsgi_factory(): # pragma: no cover - morepath.autoscan() - - App.commit() - setup_db() - - return App() - - -application = wsgi_factory() # pragma: no cover diff --git a/frameworks/Python/morepath/app/templates/fortune.jinja2 b/frameworks/Python/morepath/app/templates/fortune.jinja2 deleted file mode 100644 index e2c33c3c4af..00000000000 --- a/frameworks/Python/morepath/app/templates/fortune.jinja2 +++ /dev/null @@ -1,21 +0,0 @@ - - - - -Fortunes - - - - - - - -{% for fortune in fortunes %} - - - - -{% endfor %} -
idmessage
{{ fortune.id }}{{ fortune.message|escape }}
- - diff --git a/frameworks/Python/morepath/app/tests/test_app.py b/frameworks/Python/morepath/app/tests/test_app.py deleted file mode 100644 index 63f94e5c818..00000000000 --- a/frameworks/Python/morepath/app/tests/test_app.py +++ /dev/null @@ -1,259 +0,0 @@ -from webtest import TestApp as Client -import morepath - -import app -from app import App - - -def setup_module(module): - morepath.scan(app) - morepath.commit(App) - - -def test_json(): - """/json""" - app = App() - c = Client(app) - - response = c.get('/json', status=200) - assert response.headerlist == [ - ('Content-Type', 'application/json'), - ('Content-Length', '27') - ] - assert response.json == {"message": "Hello, World!"} - - -def test_db(): - """/db""" - app = App() - c = Client(app) - - response = c.get('/db', status=200) - assert response.content_type == 'application/json' - assert 'id' in response.json - assert 'randomNumber' in response.json - assert 1 <= response.json['id'] <= 10000 - assert 1 <= response.json['randomNumber'] <= 10000 - - -def test_queries(): - """/queries?queries=""" - app = App() - c = Client(app) - - response = c.get('/queries?queries=', status=200) - assert response.content_type == 'application/json' - assert len(response.json) == 1 - - -def test_queries_foo(): - """/queries?queries=foo""" - app = App() - c = Client(app) - - response = c.get('/queries?queries=foo', status=200) - assert response.content_type == 'application/json' - assert len(response.json) == 1 - - -def test_queries_0(): - """/queries?queries=0""" - app = App() - c = Client(app) - - response = c.get('/queries?queries=0', status=200) - assert response.content_type == 'application/json' - assert len(response.json) == 1 - - -def test_queries_999(): - """/queries?queries=999""" - app = App() - c = Client(app) - - response = c.get('/queries?queries=999', status=200) - assert response.content_type == 'application/json' - assert len(response.json) == 500 - - -def test_queries_10(): - """/queries?queries=10""" - app = App() - c = Client(app) - - response = c.get('/queries?queries=10', status=200) - assert response.content_type == 'application/json' - assert len(response.json) == 10 - - obj_list = response.json - for obj in obj_list: - assert 'id' in obj - assert 'randomNumber' in obj - assert 1 <= obj['id'] <= 10000 - assert 1 <= obj['randomNumber'] <= 10000 - - -def test_fortunes(): - """/fortunes""" - app = App() - c = Client(app) - - response = c.get('/fortunes', status=200) - assert response.headerlist == [ - ('Content-Type', 'text/html; charset=UTF-8'), - ('Content-Length', '1304') - ] - assert response.text == fortunes - - -def test_updates(): - """/updates?queries=""" - app = App() - c = Client(app) - - response = c.get('/updates?queries=', status=200) - assert response.content_type == 'application/json' - assert len(response.json) == 1 - - -def test_updates_foo(): - """/updates?queries=foo""" - app = App() - c = Client(app) - - response = c.get('/updates?queries=foo', status=200) - assert response.content_type == 'application/json' - assert len(response.json) == 1 - - -def test_updates_0(): - """/updates?queries=0""" - app = App() - c = Client(app) - - response = c.get('/updates?queries=0', status=200) - assert response.content_type == 'application/json' - assert len(response.json) == 1 - - -def test_updates_999(): - """/updates?queries=999""" - app = App() - c = Client(app) - - response = c.get('/updates?queries=999', status=200) - assert response.content_type == 'application/json' - assert len(response.json) == 500 - - -def test_updates_10(): - """/updates?queries=10""" - app = App() - c = Client(app) - - response = c.get('/updates?queries=10', status=200) - assert response.content_type == 'application/json' - assert len(response.json) == 10 - - obj_list = response.json - for obj in obj_list: - assert 'id' in obj - assert 'randomNumber' in obj - assert 1 <= obj['id'] <= 10000 - assert 1 <= obj['randomNumber'] <= 10000 - - -def test_plaintext(): - """/plaintext""" - app = App() - c = Client(app) - - response = c.get('/plaintext', status=200) - assert response.headerlist == [ - ('Content-Type', 'text/plain; charset=UTF-8'), - ('Content-Length', '13') - ] - assert response.text == 'Hello, World!' - - -fortunes = """ - - - -Fortunes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
idmessage
11<script>alert("This should not be displayed in a browser alert box.");</script>
4A bad random number generator: 1, 1, 1, 1, 1, 4.33e+67, 1, 1, 1
5A computer program does what you tell it to do, not what you want it to do.
2A computer scientist is someone who fixes things that aren't broken.
8A list is only as strong as its weakest link. — Donald Knuth
0Additional fortune added at request time.
3After enough decimal places, nobody gives a damn.
7Any program that runs right is obsolete.
10Computers make very fast, very accurate mistakes.
6Emacs is a nice operating system, but I prefer UNIX. — Tom Christaensen
9Feature: A bug with seniority.
1fortune: No such file or directory
12フレームワークのベンチマーク
- -""" diff --git a/frameworks/Python/morepath/app/view.py b/frameworks/Python/morepath/app/view.py deleted file mode 100644 index c518784a93d..00000000000 --- a/frameworks/Python/morepath/app/view.py +++ /dev/null @@ -1,79 +0,0 @@ -from random import randint - -from .app import App -from .model import Json, World, WorldQueries, WorldUpdates, Plaintext -from .collection import FortuneCollection - - -@App.json(model=Json) -def test_1(self, request): - """Test 1: JSON serialization""" - return {'message': 'Hello, World!'} - - -@App.json(model=World) -def test_2(self, request): - """Test 2: Single database query""" - return {'id': self.id, 'randomNumber': self.randomnumber} - - -@App.json(model=WorldQueries) -def test_3(self, request): - """Test 3: Multiple database queries""" - try: - queries = int(self.queries) - except ValueError: - queries = 1 - else: - if queries < 1: - queries = 1 - elif queries > 500: - queries = 500 - - result = [] - - for id_ in [randint(1, 10000) for _ in range(queries)]: - result.append({'id': id_, 'randomNumber': World[id_].randomnumber}) - - return result - - -@App.html(model=FortuneCollection, template='fortune.jinja2') -def test_4(self, request): - """Test 4: Fortunes""" - fortunes = [f.to_dict() for f in self.query()] - fortunes.append({ - 'id': 0, - 'message': 'Additional fortune added at request time.' - }) - - return {'fortunes': sorted(fortunes, key=lambda x: x['message'])} - - -@App.json(model=WorldUpdates) -def test_5(self, request): - """Test 5: Database updates""" - try: - queries = int(self.queries) - except ValueError: - queries = 1 - else: - if queries < 1: - queries = 1 - elif queries > 500: - queries = 500 - - result = [] - - for id_ in sorted(randint(1, 10000) for _ in range(queries)): - randomNumber = randint(1, 10000) - World[id_].randomnumber = randomNumber - result.append({'id': id_, 'randomNumber': randomNumber}) - - return result - - -@App.view(model=Plaintext) -def test_6(self, request): - """Test 6: Plaintext""" - return 'Hello, World!' diff --git a/frameworks/Python/morepath/benchmark_config.json b/frameworks/Python/morepath/benchmark_config.json deleted file mode 100644 index 43f1b3200d4..00000000000 --- a/frameworks/Python/morepath/benchmark_config.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "framework": "morepath", - "tests": [{ - "default": { - "json_url": "/json", - "db_url": "/db", - "query_url": "/queries?queries=", - "fortune_url": "/fortunes", - "update_url": "/updates?queries=", - "plaintext_url": "/plaintext", - "port": 8080, - "approach": "Realistic", - "classification": "Micro", - "database": "Postgres", - "framework": "morepath", - "language": "Python", - "flavor": "Python3", - "orm": "Full", - "platform": "Meinheld", - "webserver": "gunicorn", - "os": "Linux", - "database_os": "Linux", - "display_name": "Morepath", - "notes": "uses Morepath with PonyORM for database access" - } - }] -} diff --git a/frameworks/Python/morepath/config.toml b/frameworks/Python/morepath/config.toml deleted file mode 100644 index af46ef2250a..00000000000 --- a/frameworks/Python/morepath/config.toml +++ /dev/null @@ -1,19 +0,0 @@ -[framework] -name = "morepath" - -[main] -urls.plaintext = "/plaintext" -urls.json = "/json" -urls.db = "/db" -urls.query = "/queries?queries=" -urls.update = "/updates?queries=" -urls.fortune = "/fortunes" -approach = "Realistic" -classification = "Micro" -database = "Postgres" -database_os = "Linux" -os = "Linux" -orm = "Full" -platform = "Meinheld" -webserver = "gunicorn" -versus = "None" diff --git a/frameworks/Python/morepath/gunicorn_conf.py b/frameworks/Python/morepath/gunicorn_conf.py deleted file mode 100644 index bab6df83a9e..00000000000 --- a/frameworks/Python/morepath/gunicorn_conf.py +++ /dev/null @@ -1,14 +0,0 @@ -import multiprocessing -import os - -if os.environ.get('TRAVIS') == 'true': - workers = 2 -else: - workers = multiprocessing.cpu_count() * 3 - -bind = '0.0.0.0:8080' -keepalive = 120 -errorlog = '-' -pidfile = 'gunicorn.pid' - -worker_class = "meinheld.gmeinheld.MeinheldWorker" diff --git a/frameworks/Python/morepath/morepath.dockerfile b/frameworks/Python/morepath/morepath.dockerfile deleted file mode 100644 index a0fee3578cd..00000000000 --- a/frameworks/Python/morepath/morepath.dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM python:3.6.6-stretch - -ADD ./ /japronto - -WORKDIR /japronto - -RUN pip3 install -r /japronto/requirements.txt - -EXPOSE 8080 - -CMD gunicorn app.run -c gunicorn_conf.py diff --git a/frameworks/Python/morepath/requirements.txt b/frameworks/Python/morepath/requirements.txt deleted file mode 100644 index 8f58488b64e..00000000000 --- a/frameworks/Python/morepath/requirements.txt +++ /dev/null @@ -1,17 +0,0 @@ -dectate==0.13 -greenlet==0.4.14 -gunicorn==19.9.0 -importscan==0.1 -Jinja2==2.11.3 -MarkupSafe==1.0 -meinheld==1.0.2 -more.jinja2==0.2 -more.pony==0.1 -morepath==0.18.1 -pony==0.7.1 -psycopg2==2.7.5 -reg==0.11 -repoze.lru==0.6 -WebOb==1.8.8 - --e . diff --git a/frameworks/Python/morepath/setup.py b/frameworks/Python/morepath/setup.py deleted file mode 100644 index d712f4e8c87..00000000000 --- a/frameworks/Python/morepath/setup.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -from setuptools import setup, find_packages - -setup( - name='frameworkbenchmarks', - version='0.0', - description='FrameworkBenchmarks', - author='', - author_email='', - url='', - packages=find_packages(), - include_package_data=True, - zip_safe=False, - platforms='any', - install_requires=[ - 'more.pony', - 'psycopg2', - 'more.jinja2', - 'gunicorn', - 'meinheld', - ], - extras_require=dict( - test=[ - 'pytest >= 2.9.1', - 'WebTest >= 2.0.14', - 'pytest-cov', - ] - ), - entry_points=dict( - morepath=[ - 'scan = app', - ], - ), - classifiers=[ - 'Programming Language :: Python', - 'Framework :: Morepath', - 'Topic :: Internet :: WWW/HTTP', - 'Topic :: Internet :: WWW/HTTP :: WSGI :: Application', - ] -)