diff --git a/frameworks/Python/starlite/.dockerignore b/frameworks/Python/starlite/.dockerignore deleted file mode 100644 index 9fce104ae8c..00000000000 --- a/frameworks/Python/starlite/.dockerignore +++ /dev/null @@ -1,2 +0,0 @@ -.venv -README.md diff --git a/frameworks/Python/starlite/README.md b/frameworks/Python/starlite/README.md deleted file mode 100755 index 0d1452fc99a..00000000000 --- a/frameworks/Python/starlite/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# Starlite Benchmarking Test - -This is the Starlite portion of a [benchmarking tests suite](../../) -comparing a variety of web development platforms. - -The information below is specific to Starlite. For further guidance, -review the [documentation](https://github.com/TechEmpower/FrameworkBenchmarks/wiki). -Also note that there is additional information provided in -the [Python README](../). - -## Description# Starlite - -Starlite is a powerful, performant, flexible and opinionated ASGI framework, -offering first class typing support and a full [Pydantic](https://github.com/samuelcolvin/pydantic) -integration. - -Check out the [documentation 📚](https://starlite-api.github.io/starlite/). diff --git a/frameworks/Python/starlite/app.py b/frameworks/Python/starlite/app.py deleted file mode 100755 index 09a4ffa56f5..00000000000 --- a/frameworks/Python/starlite/app.py +++ /dev/null @@ -1,121 +0,0 @@ -import asyncio -import os -from operator import itemgetter -from random import randint, sample -from typing import Any - -import uvloop -from asyncpg import create_pool -from jinja2 import Template -from starlite import MediaType, Starlite, get - -asyncio.set_event_loop_policy(uvloop.EventLoopPolicy()) -connection_pool: Any = None - - -async def init_connection_pool() -> None: - global connection_pool - connection_pool = await create_pool( - user=os.getenv('PGUSER', 'benchmarkdbuser'), - password=os.getenv('PGPASS', 'benchmarkdbpass'), - database='hello_world', - host='tfb-database', - port=5432 - ) - - -def normalize_queries(value: str | None) -> int: - queries = int(value) if value and value.isnumeric() else 1 - if queries > 500: - return 500 - if queries < 1: - return 1 - return queries - - -def load_fortunes_template() -> "Template": - path = os.path.join('templates', 'fortune.html') - with open(path, 'r') as template_file: - template_text = template_file.read() - return Template(template_text) - - -fortune_template = load_fortunes_template() - - -@get(path='/json') -def json_serialization() -> dict[str, str]: - return {'message': 'Hello, world!'} - - -@get(path='/db') -async def single_database_query() -> dict[str, int]: - row_id = randint(1, 10000) - async with connection_pool.acquire() as connection: - number = await connection.fetchval( - 'SELECT "randomnumber", "id" FROM "world" WHERE id = $1', - row_id - ) - - return {'id': row_id, 'randomNumber': number} - - -@get(path='/queries') -async def multiple_database_queries(queries: None | str = None) -> list[dict[str, int]]: - row_ids = sample(range(1, 10000), normalize_queries(queries)) - worlds = [] - - async with connection_pool.acquire() as connection: - statement = await connection.prepare('SELECT "randomnumber", "id" FROM "world" WHERE id = $1') - for row_id in row_ids: - number = await statement.fetchval(row_id) - worlds.append({'id': row_id, 'randomNumber': number}) - - return worlds - - -@get(path='/fortunes', media_type=MediaType.HTML) -async def render_fortunes_template() -> str: - async with connection_pool.acquire() as connection: - fortunes = await connection.fetch('SELECT * FROM Fortune') - - fortunes.append([0, 'Additional fortune added at request time.']) - fortunes.sort(key=itemgetter(1)) - return fortune_template.render(fortunes=fortunes) - - -@get(path='/updates') -async def database_updates(queries: None | str = None) -> list[dict[str, int]]: - num_queries = normalize_queries(queries) - updates = list(zip(sorted(sample(range(1, 10000 + 1), num_queries)), sample(range(1, 10000), num_queries))) - - worlds = [ - {"id": row_id, "randomNumber": number} for row_id, number in updates - ] - - async with connection_pool.acquire() as connection: - statement = await connection.prepare('SELECT "id", "randomnumber" FROM "world" WHERE id = $1') - for row_id, _ in updates: - await statement.fetchval(row_id) - await connection.executemany('UPDATE "world" SET "randomnumber"=$1 WHERE id=$2', updates) - - return worlds - - -@get(path='/plaintext', media_type=MediaType.TEXT) -def plaintext() -> bytes: - return b'Hello, world!' - - -app = Starlite( - route_handlers=[ - database_updates, - json_serialization, - multiple_database_queries, - plaintext, - render_fortunes_template, - single_database_query, - ], - on_startup=[init_connection_pool], - openapi_config=None, -) diff --git a/frameworks/Python/starlite/benchmark_config.json b/frameworks/Python/starlite/benchmark_config.json deleted file mode 100755 index cdceafff5e4..00000000000 --- a/frameworks/Python/starlite/benchmark_config.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "framework": "starlite", - "tests": [ - { - "default": { - "json_url": "/json", - "fortune_url": "/fortunes", - "plaintext_url": "/plaintext", - "db_url": "/db", - "query_url": "/queries?queries=", - "update_url": "/updates?queries=", - "port": 8080, - "approach": "Realistic", - "classification": "Micro", - "database": "Postgres", - "framework": "Starlite", - "language": "Python", - "flavor": "Python3", - "orm": "Raw", - "platform": "None", - "webserver": "Uvicorn", - "os": "Linux", - "database_os": "Linux", - "display_name": "Starlite", - "notes": "", - "versus": "None" - } - } - ] -} diff --git a/frameworks/Python/starlite/config.toml b/frameworks/Python/starlite/config.toml deleted file mode 100644 index 3aa7c3cec44..00000000000 --- a/frameworks/Python/starlite/config.toml +++ /dev/null @@ -1,19 +0,0 @@ -[framework] -name = "starlite" - -[uvicorn] -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 = "Raw" -platform = "None" -webserver = "Uvicorn" -versus = "None" diff --git a/frameworks/Python/starlite/requirements.txt b/frameworks/Python/starlite/requirements.txt deleted file mode 100644 index d8312c6df61..00000000000 --- a/frameworks/Python/starlite/requirements.txt +++ /dev/null @@ -1,5 +0,0 @@ -asyncpg>=0.27.0 -jinja2>=3.1.2 -starlite>=1.51.0 -uvicorn[standard]>=0.20.0 -uvloop>=0.17.0 \ No newline at end of file diff --git a/frameworks/Python/starlite/starlite.dockerfile b/frameworks/Python/starlite/starlite.dockerfile deleted file mode 100644 index f51c232e4cc..00000000000 --- a/frameworks/Python/starlite/starlite.dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -FROM python:3.11 -WORKDIR /starlite/ - -RUN python -m venv /opt/venv -ENV PATH="/opt/venv/bin:$PATH" - -COPY . . - -RUN pip install --upgrade pip \ - && pip install cython==0.29.33 \ - && pip install -r /starlite/requirements.txt - -EXPOSE 8080 -CMD uvicorn app:app --host 0.0.0.0 --port 8080 --workers $(nproc) --log-level error --loop uvloop diff --git a/frameworks/Python/starlite/templates/fortune.html b/frameworks/Python/starlite/templates/fortune.html deleted file mode 100644 index 2e62ac5f7a0..00000000000 --- a/frameworks/Python/starlite/templates/fortune.html +++ /dev/null @@ -1,17 +0,0 @@ - - -
| id | -message | -
|---|---|
| {{ fortune[0] }} | -{{ fortune[1]|e }} | -