From 0741ae0a6feac9159bee0db7ad03e98432e1926e Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Fri, 25 Oct 2024 18:29:42 -0400 Subject: [PATCH] Make Windows a non-experimental platform in CI (#366) * Fix various things about the benchmarks for Windows. Make Windows a non-experimental platform in CI * Increase minimum Python version for dask * Skip dask on pypy * Re-enable for PyPy * Add workaround for PyPy * Set requires Python >= 3.12 for dask --- .github/workflows/main.yml | 2 +- doc/changelog.rst | 2 ++ .../benchmarks/bm_asyncio_websockets/run_benchmark.py | 10 +++++++++- .../benchmarks/bm_bpe_tokeniser/run_benchmark.py | 2 +- .../data-files/benchmarks/bm_dask/pyproject.toml | 2 +- .../data-files/benchmarks/bm_dask/requirements.txt | 2 +- .../data-files/benchmarks/bm_dask/run_benchmark.py | 5 ----- .../benchmarks/bm_tornado_http/requirements.txt | 2 +- 8 files changed, 16 insertions(+), 11 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 43c0b0f5..516bb431 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -49,7 +49,7 @@ jobs: experimental: true - os: windows-latest python: "3.13" - experimental: true + experimental: false steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python }} diff --git a/doc/changelog.rst b/doc/changelog.rst index b0be294d..ee5f3487 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -1,7 +1,9 @@ Changelog ========= +* Bump dask[distributed] to 2024.10.1 for Windows compatibility * Bump greenlet to 3.1.0 for compatibility with 3.13 +* Bump tornado to 6.2.0 Version 1.11.0 (2024-03-09) -------------- diff --git a/pyperformance/data-files/benchmarks/bm_asyncio_websockets/run_benchmark.py b/pyperformance/data-files/benchmarks/bm_asyncio_websockets/run_benchmark.py index 1f167f6f..12d2df45 100644 --- a/pyperformance/data-files/benchmarks/bm_asyncio_websockets/run_benchmark.py +++ b/pyperformance/data-files/benchmarks/bm_asyncio_websockets/run_benchmark.py @@ -8,6 +8,7 @@ import pyperf import websockets.server import websockets.client +import websockets.exceptions import asyncio CHUNK_SIZE = 1024 ** 2 @@ -23,13 +24,20 @@ async def handler(websocket) -> None: stop.set() +async def send(ws): + try: + await ws.send(DATA) + except websockets.exceptions.ConnectionClosedOK: + pass + + async def main() -> None: global stop t0 = pyperf.perf_counter() stop = asyncio.Event() async with websockets.server.serve(handler, "", 8001): async with websockets.client.connect("ws://localhost:8001") as ws: - await asyncio.gather(*[ws.send(DATA) for _ in range(100)]) + await asyncio.gather(*[send(ws) for _ in range(100)]) await stop.wait() return pyperf.perf_counter() - t0 diff --git a/pyperformance/data-files/benchmarks/bm_bpe_tokeniser/run_benchmark.py b/pyperformance/data-files/benchmarks/bm_bpe_tokeniser/run_benchmark.py index 129392a8..2a544ac7 100644 --- a/pyperformance/data-files/benchmarks/bm_bpe_tokeniser/run_benchmark.py +++ b/pyperformance/data-files/benchmarks/bm_bpe_tokeniser/run_benchmark.py @@ -140,7 +140,7 @@ def train(data: str): def bench_bpe_tokeniser(loops: int) -> float: DATA = Path(__file__).parent / "data" / "frankenstein_intro.txt" - with open(DATA, "r") as f: + with open(DATA, "r", encoding="utf8") as f: data = f.read() range_it = range(loops) diff --git a/pyperformance/data-files/benchmarks/bm_dask/pyproject.toml b/pyperformance/data-files/benchmarks/bm_dask/pyproject.toml index 747fb2f2..4af6cd2e 100644 --- a/pyperformance/data-files/benchmarks/bm_dask/pyproject.toml +++ b/pyperformance/data-files/benchmarks/bm_dask/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "pyperformance_bm_dask" -requires-python = ">=3.8" +requires-python = ">=3.12" dependencies = ["pyperf"] urls = {repository = "https://github.com/python/pyperformance"} dynamic = ["version"] diff --git a/pyperformance/data-files/benchmarks/bm_dask/requirements.txt b/pyperformance/data-files/benchmarks/bm_dask/requirements.txt index 374cf38a..3b8ca8e1 100644 --- a/pyperformance/data-files/benchmarks/bm_dask/requirements.txt +++ b/pyperformance/data-files/benchmarks/bm_dask/requirements.txt @@ -1 +1 @@ -dask[distributed]==2022.2.0 +dask[distributed]==2024.10.0 diff --git a/pyperformance/data-files/benchmarks/bm_dask/run_benchmark.py b/pyperformance/data-files/benchmarks/bm_dask/run_benchmark.py index 09719457..2a684e41 100644 --- a/pyperformance/data-files/benchmarks/bm_dask/run_benchmark.py +++ b/pyperformance/data-files/benchmarks/bm_dask/run_benchmark.py @@ -4,8 +4,6 @@ Author: Matt Rocklin, Michael Droettboom """ -import sys - from dask.distributed import Client, Worker, Scheduler, wait from dask import distributed @@ -29,9 +27,6 @@ async def benchmark(): if __name__ == "__main__": - if distributed.__version__ <= "2024.5.0" and sys.version_info >= (3, 13) and sys.platform == "win32": - raise RuntimeError("Benchmark doesn't work with Python 3.13 on Windows") - runner = pyperf.Runner() runner.metadata['description'] = "Benchmark dask" runner.bench_async_func('dask', benchmark) diff --git a/pyperformance/data-files/benchmarks/bm_tornado_http/requirements.txt b/pyperformance/data-files/benchmarks/bm_tornado_http/requirements.txt index ca2eb1c6..e9eefea6 100644 --- a/pyperformance/data-files/benchmarks/bm_tornado_http/requirements.txt +++ b/pyperformance/data-files/benchmarks/bm_tornado_http/requirements.txt @@ -1 +1 @@ -tornado==6.1 +tornado==6.2