refactor(bench): 📦 release the benchmark harness as monoprop-bench-tools - #227
Draft
Panadestein wants to merge 1 commit into
Draft
refactor(bench): 📦 release the benchmark harness as monoprop-bench-tools#227Panadestein wants to merge 1 commit into
Panadestein wants to merge 1 commit into
Conversation
Turn the repository into a uv workspace and split the benchmark harness in two: the reusable half becomes a published package, the benchmarks stay here. - packages/monoprop-bench-tools: peak-memory measurement (memory.cpu, memory.gpu), the benchmarked model builders (models), and the artifact renderers (report, bmf), plus the monoprop-bench-report / monoprop-bench-bmf console scripts. Pure Python, built by hatchling, versioned off the same git tags as monoprop. - benches/ keeps conftest.py and the bench_* suite and imports the package. Benchmark names are Bencher's history key, so the suite must not move with a library release. - packages/bench-third-party: the cross-engine comparison scripts, moved out of benches/third_party and excluded from the workspace (narrower requires-python, a git dependency and linux-x86_64-only CUDA wheels). It now depends on the tools package instead of poking benches/ onto sys.path. Dependency groups follow the split: `test` stays free of workspace members so cibuildwheel can install it against a built wheel, `workspace-test` adds the new member and is what the root suite needs, and `bench` builds on that. deploy.yml gains a job that builds and publishes monoprop-bench-tools; it is a separate PyPI project, so it needs its own trusted-publisher entry. Assisted-by: GitHubCopilot:claude-opus-5
|
Docs preview: https://pr-227.monoprop-docs.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 AI text below 🤖
Turns the repository into a uv workspace and splits the benchmark harness in two: the reusable half becomes a package we can publish, the benchmarks stay here.
What moved
benches/_memory_cpu.pymonoprop_bench_tools.memory.cpubenches/_memory_gpu.pymonoprop_bench_tools.memory.gpubenches/_builders.pymonoprop_bench_tools.modelsbenches/report.pymonoprop_bench_tools.report→monoprop-bench-reportbenches/bmf.pymonoprop_bench_tools.bmf→monoprop-bench-bmftests/test_bench_*.pypackages/monoprop-bench-tools/tests/benches/third_party/packages/bench-third-party/All moves are
git mv, sogit log --followstill works.Design decisions worth reviewing
benches/does not move. Bencher keys its metric history on the benchmark name, so moving or renaming abench_*test orphans its tracked series and resets the thresholds' sample windows. The suite therefore cannot version with a library release, which is precisely the line between "harness" and "benchmarks".monoprop-bench-toolscontains no benchmarks.The bencher.dev tracking stays in the repo. Only the renderer (
bmf.py) is tooling and moved.bench_main.ymlcarriesBENCHER_API_KEY,vars.BENCHER_PROJECT, the--branch/--testbedidentity and the four threshold blocks — that is this repository's CI identity, and a published package cannot own a secret. The workflow itself is unchanged;just bench-bmfnow shells out to the console script.Three dependency groups instead of two.
test— monoprop's suite only, deliberately free of workspace members. cibuildwheel installs it against a built wheel viatest-groups = ["test"], where amonoprop-bench-toolsrequirement would resolve from PyPI (nonexistent) and drag monoprop back in from source.workspace-test—test+ the member. Whatuv run pytestat the root needs.bench—workspace-test+pytest-benchmark.bench-third-partyisexcluded from the workspace. It pins a narrowerrequires-python, a git dependency and linux-x86_64-only CUDA wheels; folding it in would drag all of that into the root lock. It stays a standalone uv project with its own lockfile (cd packages/bench-third-party && uv sync). It now depends onmonoprop-bench-toolsproperly instead of pokingbenches/ontosys.path.No
gpuextra on the tools package. Adding one putcupy-cuda12x+cuda-pathfinderinto the root lock. CuPy is installed separately;memory.gpualready degrades toMethod.UNAVAILABLEwithout it.Publishing
deploy.ymlgainsbuild-bench-tools(uv build --package monoprop-bench-tools— pure Python, no cibuildwheel matrix) and a separateupload_pypi_bench_toolsjob. Separate because it is a separate PyPI project, and because a failure there must not hold back the library's own upload. hatch-vcs reads the same git tags viaraw-options = { root = "../.." }, so the two distributions share a version line; verified that the wheel still builds from the sdist, where there is no git.Important
Before the next release someone has to register a trusted publisher for
monoprop-bench-toolson PyPI (this workflow file, thepypienvironment), orupload_pypi_bench_toolswill fail on its first run.Validation
uv lock --check,uv sync --all-groups --all-extraspytest -m "not mpi"→ 617 passed (both suites)just bench-smokeandjust bench-bmf smokeend to end through the console scriptspackages/bench-third-party/uv.lockre-resolvedprek run --all-filescleanDeliberate non-changes
packages/**is excluded from Sonar scope, preserving current behaviour. Bringing it in is a separate call.benches/results/*.jsonis untouched, so Bencher continuity holds.One seam this creates
benches/conftest.pywrites the results artifact schema andmonoprop_bench_tools.report/.bmfread it — now across a package boundary. Called out in both docstrings and inAGENTS.md: a change to the recorded sections has to land on both sides.Docs updated in the same change:
AGENTS.md(new "Workspace layout" section),README.md,docs/content/docs/benchmarks.mdx,docs/content/docs/testing.mdx,benches/README.md.