Skip to content

chore: bump ruff, pyright and pytest, and add uv.lock - #283

Merged
winstonliu1111 merged 11 commits into
mlcommons:mainfrom
Keysight:chore/issue-262-lock-and-bump
Nov 24, 2026
Merged

winstonliu1111 merged 11 commits into
mlcommons:mainfrom
Keysight:chore/issue-262-lock-and-bump

Conversation

@winstonliu1111

Copy link
Copy Markdown
Contributor

Closes #262. Part of Goal 0 (#260), Phase 2.

What this PR does

  • Moves ruff, pyright and pytest to new versions (ruff 0.3.7 to 0.17.6, pyright 1.1.359 to 1.1.414, pytest 8.1.1 to 9.2.0).
  • Fixes what the new versions report. Formats the code with the new ruff, in its own commit.
  • Adds [tool.pytest.ini_options].
  • Commits uv.lock. It records the exact version of every package, so two people get the same environment.
  • Adds .git-blame-ignore-revs with the format commit.
  • Adds just lock-check and runs it first in just gate.

The param group and its pin test are not in this PR. #257 already removed them.

Commits

Each commit passes the checks that apply to it. The fixes pass with the old and the new tools, so the history stays green.

flowchart LR
  A["1-2 pytest settings"] --> B["3 fixes"] --> C["4 ruff format"] --> D["5 bump pins"] --> E["6 uv.lock"] --> F["7 lock-check"] --> G["8 blame-ignore"] --> H["9-11 docs and tests"]
Loading
# Commit What it holds
1 test: run pytest on tests/ and reject unknown markers testpaths, --strict-markers.
2 fix: let bare pytest import the src package pythonpath = ["."]. Bare pytest could not collect 2 test files.
3 fix: clear what newer ruff and pyright report SIM103 in is_cpu_op. The HostTrace.__init__ overload. A test for the ProfilerStep name rule.
4 style: format with ruff 0.17.6 2 files, 3 lines. Only line wraps.
5 chore: bump ruff, pyright and pytest pyproject.toml and requirements-dev.txt.
6 chore: add uv.lock and stop ignoring it 140 packages, all from pypi.org.
7 chore: add a lock-check recipe and run it first in the gate uv lock --check.
8 chore: add .git-blame-ignore-revs for the ruff format commit Hash of commit 4.
9 docs: explain the lock file and the blame-ignore file doc/DEVELOPMENT.md.
10, 11 fix: and test: Review fixes in tests only.

What changes for contributors

  • CI uses the new versions. The CI lint job installs requirements-dev.txt. Your PR can show new ruff or pyright messages. Run just lint and just types to see them.
  • uv.lock is committed. After you change dependencies or [dependency-groups], run uv lock and commit the file. just lock-check fails when you forget. uv run and uv sync would change an old lock without a warning.
  • Lock conflict: do not merge uv.lock by hand. Take the file from main, then run uv lock.
  • Git blame: run git config blame.ignoreRevsFile .git-blame-ignore-revs once. GitHub reads the file by itself.
  • ruff 0.17 also formats Python code in Markdown files. All current .md files already pass.
  • The pip setup still works. pip install -r requirements-dev.txt installs the new versions. pip does not read uv.lock.

Acceptance criteria

Criterion Evidence
uv sync --locked passes in a fresh clone Clone of this branch from GitHub: exit 0. Also exit 0 on macOS from a local clone, and in a Linux aarch64 container (Python 3.11.14). uv.lock was unchanged.
just gate passes with the new tool versions Clean clone at the tip 598b749: exit 0. uv lock --check: Resolved 140 packages. 49 files already formatted. All checks passed!. 0 errors, 4 warnings. 269 passed, 2 skipped. Slow tests: 2 passed. wheel_check: the wheel is complete and works with protobuf 6.31.1 and the newest protobuf.
The format commit is in .git-blame-ignore-revs Line 602 of src/trace_link/trace_linker.py. Without the flag: c7d613ce (winstonliu1111 2026-11-24). With --ignore-revs-file: a6590feb (Taekyung Heo 2024-07-12). The GitHub blame API shows a6590fe for the same line on this branch.
An open branch needs one merge or rebase at most Merge test of this branch against every open PR (table below).

Merge test against the open PRs

PR Result
#182, #272 Merge is clean. The merged tree passes ruff, pyright and lock-check.
#281, #282 One conflict each, because of this PR. Adjacent rows in doc/DEVELOPMENT.md. For #282 also the gate: line in justfile. Keep both sides.
#221, #231, #270, #273 Conflict with main already, in the same files. This PR adds no conflict.

Other checks

  • just act with python_lint.yml, python_tests.yml and end_to_end_tests.yml on commit 9: all Job succeeded. The two later commits change only tests/test_tooling.py.
  • Failure path of lock-check: with ruff==0.17.5 in a copy of pyproject.toml and the old lock, uv lock --check fails: The lockfile at uv.lock needs to be updated, but --check was provided.
  • An independent review of the full diff found no blocker. One test checked only that a commit object exists, not that HEAD reaches it. Commit 10 fixes it.

Not tested

Generated with Claude Code

winstonliu1111 and others added 11 commits November 24, 2026 11:15
A typo in a marker name only gave a warning, and the test ran
unmarked. --strict-markers makes it an error. testpaths lets
bare `pytest` find tests/.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Two tests import `src.…`. `python -m pytest` finds the package,
because it adds the current folder to the path. Bare `pytest` did
not, and it could not collect those tests. pythonpath = ["."] fixes it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
ruff 0.17 flags if/return True/return False (SIM103) in
KinetoOperator.is_cpu_op. pyright 1.1.414 flags the HostTrace
constructor: the default HostNode is not a Type[N]. Both fixes
also pass with the pinned ruff 0.3.7 and pyright 1.1.359, so
every commit stays green. A test pins the ProfilerStep name rule.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The newer ruff joins implicit f-string concatenations that fit in
120 columns. This commit holds only that output, so that
.git-blame-ignore-revs can list it. The pinned ruff 0.3.7 also
accepts the result.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
ruff 0.3.7 -> 0.17.6, pyright 1.1.359 -> 1.1.414,
pytest 8.1.1 -> 9.2.0. The commits before this one already
fix what the new versions report. vulture, build and twine stay.
pyproject.toml and requirements-dev.txt must name the same
versions (test_dev_group_pins_equal_requirements_dev).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The lock file records every package of the environment, so two
people get the same one. Generated with `uv lock` (140 packages,
all from pypi.org, resolved for Python 3.11 to 3.14 on all
platforms). Pyright, pytest and ruff are locked at the pins
from the previous commit.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
`uv run` and `uv sync` rewrite a stale uv.lock without a warning.
`just lock-check` runs `uv lock --check` and fails instead. The
gate runs it first, before any recipe that runs uv.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
git blame skips the listed commit and shows the earlier author of each
line. GitHub reads this file by its name. Two tests check that every
line is a full hash, and that each commit is in the history.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Add a lock file section, a git blame section, and steps for a
conflict in uv.lock. Say that pip does not read uv.lock. Remove
the stale claim that bare pytest cannot collect the tests (the
pytest settings fixed it), in the justfile and in a test comment.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
git cat-file only proves that the commit object exists. After a rebase
the old commit stays in the local store but HEAD no longer reaches it.
Use git merge-base --is-ancestor instead.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
test_justfile_does_not_say_that_bare_pytest_fails only checked that
a comment stayed deleted. It protected no behavior. The test of the
pytest settings already guards what the comment was about.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@mlcommons-cla-bot

Copy link
Copy Markdown

MLCommons CLA bot: All contributors are covered by the MLCommons CLA ✍️ ✅

@danmih-ixia danmih-ixia left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@winstonliu1111
winstonliu1111 merged commit 065445b into mlcommons:main Nov 24, 2026
10 checks passed
@winstonliu1111
winstonliu1111 deleted the chore/issue-262-lock-and-bump branch November 25, 2026 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pin the dev tools and add uv.lock

3 participants