소스 검색

[python/starlite] Remove starlite (#9646)

Starlite is currently failing and hasn't been updated in 3 years: https://github.com/Harry-Lees/starlite
Petrik de Heus 6 달 전
부모
커밋
bc579443a3

+ 0 - 2
frameworks/Python/starlite/.dockerignore

@@ -1,2 +0,0 @@
-.venv
-README.md

+ 0 - 17
frameworks/Python/starlite/README.md

@@ -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/).

+ 0 - 121
frameworks/Python/starlite/app.py

@@ -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,
-)

+ 0 - 30
frameworks/Python/starlite/benchmark_config.json

@@ -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"
-      }
-    }
-  ]
-}

+ 0 - 19
frameworks/Python/starlite/config.toml

@@ -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"

+ 0 - 5
frameworks/Python/starlite/requirements.txt

@@ -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

+ 0 - 14
frameworks/Python/starlite/starlite.dockerfile

@@ -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

+ 0 - 17
frameworks/Python/starlite/templates/fortune.html

@@ -1,17 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head><title>Fortunes</title></head>
-<body>
-<table>
-    <tr>
-        <th>id</th>
-        <th>message</th>
-    </tr>
-    {% for fortune in fortunes %}
-        <tr>
-            <td>{{ fortune[0] }}</td>
-            <td>{{ fortune[1]|e }}</td>
-        </tr>
-    {% endfor %}</table>
-</body>
-</html>