diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 13c177fa..8bd341ac 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -2,3 +2,5 @@ version: 2 updates: - package-ecosystem: "pip" directory: "/pyperformance/requirements" + schedule: + interval: "monthly" diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index becf1a59..8f1a8748 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,29 +23,26 @@ jobs: matrix: # Test all supported versions on Ubuntu: os: [ubuntu-latest] - python: ["3.7", "3.8", "3.9", "3.10", "3.11"] + python: ["3.8", "3.9", "3.10", "3.11", "3.12"] experimental: [false] include: # As the experimental task for the dev version. - os: ubuntu-latest - python: "3.12-dev" + python: "3.13-dev" experimental: true # Also test PyPy, macOS, and Windows: - os: ubuntu-latest - python: pypy-3.9 - experimental: false - - os: ubuntu-latest - python: pypy-3.8 + python: pypy-3.10 experimental: false - os: ubuntu-latest - python: pypy-3.7 + python: pypy-3.9 experimental: false - os: macos-latest - python: "3.10" - experimental: false + python: "3.12" + experimental: true - os: windows-latest - python: "3.10" - experimental: false + python: "3.12" + experimental: true steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python }} diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 00000000..8ff5ab71 --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,12 @@ +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +version: 2 + +build: + os: ubuntu-22.04 + tools: + python: "3.11" + +sphinx: + configuration: doc/conf.py diff --git a/doc/benchmarks.rst b/doc/benchmarks.rst index b0cff367..54c5e69c 100644 --- a/doc/benchmarks.rst +++ b/doc/benchmarks.rst @@ -453,7 +453,7 @@ Copyright Callum and Tony Garnock-Jones, 2008. This file may be freely redistributed under the MIT license, http://www.opensource.org/licenses/mit-license.php -From http://www.lshift.net/blog/2008/10/29/toy-raytracer-in-python +From https://leastfixedpoint.com/tonyg/kcbbs/lshift_archive/toy-raytracer-in-python-20081029.html .. image:: images/bm_raytrace.jpg :alt: Pure Python raytracer diff --git a/doc/changelog.rst b/doc/changelog.rst index 34eae5ed..de5c0126 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -1,6 +1,13 @@ Changelog ========= +Version 1.10.0 (2023-10-22) +-------------- +* Add benchmark for asyncio_webockets +* Expose --min-time from pyperf to pyperformance CLI +* Bump coverage to 7.3.2 for compatibilty with 3.13 +* Bump greenlet to 3.0.0rc3 for compatibilty with 3.13 + Version 1.0.9 (2023-06-14) ------------- * Vendor lib2to3 for Python 3.13+ diff --git a/doc/conf.py b/doc/conf.py index 05235328..20b805b5 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -62,7 +62,7 @@ # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. -language = None +language = "en" # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. diff --git a/pyperformance/__init__.py b/pyperformance/__init__.py index 92479b50..3941313b 100644 --- a/pyperformance/__init__.py +++ b/pyperformance/__init__.py @@ -2,7 +2,7 @@ import sys -VERSION = (1, 0, 9) +VERSION = (1, 10, 0) __version__ = '.'.join(map(str, VERSION)) diff --git a/pyperformance/cli.py b/pyperformance/cli.py index 330d6e57..34544a11 100644 --- a/pyperformance/cli.py +++ b/pyperformance/cli.py @@ -72,6 +72,9 @@ def parse_args(): cmd.add_argument("--append", metavar="FILENAME", help="Add runs to an existing file, or create it " "if it doesn't exist") + cmd.add_argument("--min-time", metavar="MIN_TIME", + help="Minimum duration in seconds of a single " + "value, used to calibrate the number of loops") filter_opts(cmd) # show diff --git a/pyperformance/data-files/benchmarks/MANIFEST b/pyperformance/data-files/benchmarks/MANIFEST index 4420f98b..b4d22f7b 100644 --- a/pyperformance/data-files/benchmarks/MANIFEST +++ b/pyperformance/data-files/benchmarks/MANIFEST @@ -21,6 +21,7 @@ async_tree_eager_io_tg async_tree_eager_memoization_tg asyncio_tcp asyncio_tcp_ssl +asyncio_websockets concurrent_imap coroutines coverage diff --git a/pyperformance/data-files/benchmarks/bm_asyncio_websockets/pyproject.toml b/pyperformance/data-files/benchmarks/bm_asyncio_websockets/pyproject.toml new file mode 100644 index 00000000..e985b0e1 --- /dev/null +++ b/pyperformance/data-files/benchmarks/bm_asyncio_websockets/pyproject.toml @@ -0,0 +1,9 @@ +[project] +name = "pyperformance_bm_asyncio_websockets" +requires-python = ">=3.8" +dependencies = ["pyperf", "websockets"] +urls = {repository = "https://github.com/python/pyperformance"} +dynamic = ["version"] + +[tool.pyperformance] +name = "asyncio_websockets" diff --git a/pyperformance/data-files/benchmarks/bm_asyncio_websockets/requirements.txt b/pyperformance/data-files/benchmarks/bm_asyncio_websockets/requirements.txt new file mode 100644 index 00000000..e3e82768 --- /dev/null +++ b/pyperformance/data-files/benchmarks/bm_asyncio_websockets/requirements.txt @@ -0,0 +1 @@ +websockets==11.0.3 \ No newline at end of file diff --git a/pyperformance/data-files/benchmarks/bm_asyncio_websockets/run_benchmark.py b/pyperformance/data-files/benchmarks/bm_asyncio_websockets/run_benchmark.py new file mode 100644 index 00000000..1f167f6f --- /dev/null +++ b/pyperformance/data-files/benchmarks/bm_asyncio_websockets/run_benchmark.py @@ -0,0 +1,40 @@ +""" +Benchmark for asyncio websocket server and client performance +transferring 1MB of data. + +Author: Kumar Aditya +""" + +import pyperf +import websockets.server +import websockets.client +import asyncio + +CHUNK_SIZE = 1024 ** 2 +DATA = b"x" * CHUNK_SIZE + +stop: asyncio.Event + + +async def handler(websocket) -> None: + for _ in range(100): + await websocket.recv() + + stop.set() + + +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 stop.wait() + return pyperf.perf_counter() - t0 + + +if __name__ == "__main__": + runner = pyperf.Runner() + runner.metadata['description'] = "Benchmark asyncio websockets" + runner.bench_async_func('asyncio_websockets', main) diff --git a/pyperformance/data-files/benchmarks/bm_coverage/requirements.txt b/pyperformance/data-files/benchmarks/bm_coverage/requirements.txt index 755f8b95..b13cbb7c 100644 --- a/pyperformance/data-files/benchmarks/bm_coverage/requirements.txt +++ b/pyperformance/data-files/benchmarks/bm_coverage/requirements.txt @@ -1 +1 @@ -coverage==6.4.1 +coverage==7.3.2 diff --git a/pyperformance/data-files/benchmarks/bm_sqlalchemy_declarative/requirements.txt b/pyperformance/data-files/benchmarks/bm_sqlalchemy_declarative/requirements.txt index af076efe..9578d705 100644 --- a/pyperformance/data-files/benchmarks/bm_sqlalchemy_declarative/requirements.txt +++ b/pyperformance/data-files/benchmarks/bm_sqlalchemy_declarative/requirements.txt @@ -1,2 +1,2 @@ -greenlet==2.0.0a2 +greenlet==3.0.0rc3 sqlalchemy==1.4.19 diff --git a/pyperformance/data-files/benchmarks/bm_sqlalchemy_imperative/requirements.txt b/pyperformance/data-files/benchmarks/bm_sqlalchemy_imperative/requirements.txt index af076efe..9578d705 100644 --- a/pyperformance/data-files/benchmarks/bm_sqlalchemy_imperative/requirements.txt +++ b/pyperformance/data-files/benchmarks/bm_sqlalchemy_imperative/requirements.txt @@ -1,2 +1,2 @@ -greenlet==2.0.0a2 +greenlet==3.0.0rc3 sqlalchemy==1.4.19 diff --git a/pyperformance/requirements/requirements.txt b/pyperformance/requirements/requirements.txt index 988c67b1..d4aa6631 100644 --- a/pyperformance/requirements/requirements.txt +++ b/pyperformance/requirements/requirements.txt @@ -10,5 +10,5 @@ psutil==5.9.5 # via # -r requirements.in # pyperf -pyperf==2.6.0 +pyperf==2.6.1 # via -r requirements.in diff --git a/pyperformance/run.py b/pyperformance/run.py index 65e1a9e9..aa2b3744 100644 --- a/pyperformance/run.py +++ b/pyperformance/run.py @@ -206,5 +206,7 @@ def get_pyperf_opts(options): opts.append('--track-memory') if options.inherit_environ: opts.append('--inherit-environ=%s' % ','.join(options.inherit_environ)) + if options.min_time: + opts.append('--min-time=%s' % options.min_time) return opts