From e362609694ce18e937b81d32415436529f330b9e Mon Sep 17 00:00:00 2001 From: Tin Tvrtkovic Date: Sat, 13 Dec 2025 01:18:27 +0100 Subject: [PATCH 1/4] feat: add initial codspeed integration --- .github/workflows/codspeed.yml | 42 ++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/codspeed.yml diff --git a/.github/workflows/codspeed.yml b/.github/workflows/codspeed.yml new file mode 100644 index 00000000..48823a44 --- /dev/null +++ b/.github/workflows/codspeed.yml @@ -0,0 +1,42 @@ +name: CodSpeed Benchmarks + +on: + push: + branches: [main] + tags: ["*"] + paths: + - src/**.py + - bench/** + - .github/workflows/codspeed.yml + pull_request: + paths: + - src/**.py + - bench/** + - .github/workflows/codspeed.yml + workflow_dispatch: + +permissions: + contents: read # required for actions/checkout + id-token: write # required for OIDC authentication with CodSpeed + +jobs: + codspeed: + name: Run CodSpeed benchmarks + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v6.0.0 # Use a fixed version + with: + persist-credentials: false + - uses: actions/setup-python@v6.1.0 # Use a fixed version + with: + python-version: "3.11" # Assuming Python 3.11, adjust if needed + - uses: hynek/setup-cached-uv@v2.3.0 # Use a fixed version + + - name: Run CodSpeed benchmarks + uses: CodSpeedHQ/action@v4.4.1 # Use a fixed version + with: + mode: instrumentation + run: | + uv pip install pytest-codspeed + uv run pytest --codspeed bench/ From 43a778977a92b6fe7acd84b7e640bac1468235c1 Mon Sep 17 00:00:00 2001 From: Tin Tvrtkovic Date: Sun, 14 Dec 2025 21:26:55 +0100 Subject: [PATCH 2/4] Tweak action --- .github/workflows/codspeed.yml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/codspeed.yml b/.github/workflows/codspeed.yml index 48823a44..371a294a 100644 --- a/.github/workflows/codspeed.yml +++ b/.github/workflows/codspeed.yml @@ -25,18 +25,20 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v6.0.0 # Use a fixed version + - uses: actions/checkout@v6.0.0 with: persist-credentials: false - - uses: actions/setup-python@v6.1.0 # Use a fixed version + + - uses: actions/setup-python@v6.1.0 with: - python-version: "3.11" # Assuming Python 3.11, adjust if needed - - uses: hynek/setup-cached-uv@v2.3.0 # Use a fixed version + python-version: "3.14" + + - uses: hynek/setup-cached-uv@757bedc3f972eb7227a1aa657651f15a8527c817 # v2.3.0 - name: Run CodSpeed benchmarks - uses: CodSpeedHQ/action@v4.4.1 # Use a fixed version + uses: CodSpeedHQ/action@346a2d8a8d9d38909abd0bc3d23f773110f076ad # v4.4.1 with: - mode: instrumentation + mode: simulation run: | - uv pip install pytest-codspeed + uv pip install pytest pytest-codspeed uv run pytest --codspeed bench/ From 0d960655f7434a69ba0f59d41df1a2c08c2033de Mon Sep 17 00:00:00 2001 From: Tin Tvrtkovic Date: Sun, 14 Dec 2025 21:33:02 +0100 Subject: [PATCH 3/4] Tweak --- .github/workflows/codspeed.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/codspeed.yml b/.github/workflows/codspeed.yml index 371a294a..d5bc38d8 100644 --- a/.github/workflows/codspeed.yml +++ b/.github/workflows/codspeed.yml @@ -39,6 +39,4 @@ jobs: uses: CodSpeedHQ/action@346a2d8a8d9d38909abd0bc3d23f773110f076ad # v4.4.1 with: mode: simulation - run: | - uv pip install pytest pytest-codspeed - uv run pytest --codspeed bench/ + run: uv run --with pytest-codspeed --with pytest-benchmark pytest --codspeed bench/ From 044f78c644171987b537f37659315d61c954f8ca Mon Sep 17 00:00:00 2001 From: Tin Tvrtkovic Date: Sun, 14 Dec 2025 21:47:49 +0100 Subject: [PATCH 4/4] Changelog --- HISTORY.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/HISTORY.md b/HISTORY.md index 91280f88..d2936bc2 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -21,6 +21,8 @@ Our backwards-compatibility policy can be found [here](https://github.com/python ([#696](https://github.com/python-attrs/cattrs/pull/696)) - Use the optional `_value_` type hint to structure and unstructure enums if present. ([##699](https://github.com/python-attrs/cattrs/issues/699)) +- _cattrs_ now tracks performance using [codspeed](https://codspeed.io/python-attrs/cattrs). + ([#703](https://github.com/python-attrs/cattrs/pull/703)) ## 25.3.0 (2025-10-07)