Skip to content

Commit d0ed3fc

Browse files
AdamGSdanking
andauthored
Python benchmarks script and re-organize dev dependencies (#7192)
## Summary 1. Add a script to run the python benchmarks which are basically a secret right now. 2. Re-organize dev-dependencies, now that UV does support transitive dev dependencies --------- Signed-off-by: Adam Gutglick <adam@spiraldb.com> Co-authored-by: Dan King <dan@spiraldb.com>
1 parent 60847b0 commit d0ed3fc

File tree

6 files changed

+58
-41
lines changed

6 files changed

+58
-41
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ jobs:
6969
- name: Python Lint - PyRight
7070
env:
7171
MATURIN_PEP517_ARGS: "--profile dev"
72-
run: uv run basedpyright vortex-python
72+
run: |
73+
uv sync --all-packages
74+
uv run basedpyright vortex-python
7375
7476
python-test:
7577
name: "Python (test)"

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,3 +238,6 @@ sweep.timestamp
238238
# Perfetto
239239
trace*.json
240240
trace*.pb
241+
242+
# pytest-benchmark output
243+
vortex-python/.benchmarks/

pyproject.toml

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,17 @@ build-backend = "hatchling.build"
1414
packages = ["dummy"] # Required for workspace project
1515

1616
[dependency-groups]
17-
# Currently, all dev dependencies live in the root since uv doesn't have transitive dev dependencies.
18-
# See: https://github.com/astral-sh/uv/issues/7541
17+
# Shared dev tooling. Member-specific dev deps live in each member's pyproject.toml.
18+
# `uv sync --all-packages` picks up dev groups from all workspace members.
1919
dev = [
2020
"basedpyright>=1.31",
21-
"duckdb>=1.1.2",
2221
"ipython>=8.26.0",
23-
"maturin>=1.7.2",
24-
"pandas-stubs>=2.2.3.241126",
25-
"pandas[output-formatting]>=2.2.3",
26-
"pcodec>=0.3.3",
2722
"pip>=23.3.2",
28-
"polars>=1.9.0",
29-
"pyarrow-stubs>=17.16",
30-
"pytest-benchmark>=4.0.0",
3123
"pytest>=7.4.0",
3224
"ruff>=0.7.1",
33-
"ray>=2.48",
34-
"pytest-benchmark>=5.1.0",
3525
# forced transitive bumps
3626
"urllib3>=2.6.3",
3727
"filelock>=3.20.3",
38-
"protobuf>=6.33.5",
3928
]
4029

4130
[tool.uv]

uv.lock

Lines changed: 12 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vortex-python/pyproject.toml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,22 @@ include = [
6767
{ path = "python/vortex/py.typed", format = "sdist" },
6868
]
6969

70-
[tool.basedpyright]
71-
exclude = ["python/vortex/_lib/store/**.pyi"]
72-
7370
[dependency-groups]
7471
dev = [
75-
"basedpyright>=1.31",
72+
"duckdb>=1.1.2",
73+
"maturin>=1.7.2",
7674
"numpy>=2.2.2",
7775
"pandas-stubs>=2.2.3.241126",
76+
"pandas[output-formatting]>=2.2.3",
7877
"pcodec>=0.3.3",
78+
"polars>=1.9.0",
7979
"pyarrow-stubs>=17.16",
8080
"pytest-benchmark>=5.1.0",
8181
"pytest-xdist>=3.5.0",
82+
"ray>=2.48",
83+
# forced transitive bumps
84+
"protobuf>=6.33.5",
8285
]
86+
87+
[tool.basedpyright]
88+
exclude = ["python/vortex/_lib/store/**.pyi"]

vortex-python/run_benchmarks.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
# SPDX-License-Identifier: Apache-2.0
3+
# SPDX-FileCopyrightText: Copyright the Vortex contributors
4+
5+
# Run Python benchmarks with a release-profile build of the native extension.
6+
#
7+
# Usage:
8+
# ./run_benchmarks.sh # run all benchmarks
9+
# ./run_benchmarks.sh -k "test_scan" # run benchmarks matching a pattern
10+
# ./run_benchmarks.sh --benchmark-only # skip non-benchmark tests (if any)
11+
#
12+
# All arguments are forwarded to pytest.
13+
14+
set -ex -o pipefail
15+
16+
ROOT=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )/.." &> /dev/null && pwd )
17+
PYTHON_DIR="$ROOT/vortex-python"
18+
19+
# Ensure all packages are synced (includes pytest-benchmark dev dependency).
20+
uv sync --all-packages
21+
22+
source "$ROOT/.venv/bin/activate"
23+
24+
# Build the native extension in release mode so benchmarks reflect production performance.
25+
maturin develop --release --manifest-path "$PYTHON_DIR/Cargo.toml"
26+
27+
# Run benchmarks. Extra args are forwarded to pytest.
28+
pytest "$PYTHON_DIR/benchmark" "$@"

0 commit comments

Comments
 (0)