Skip to content

chore(pytest): migrate Python tooling from rye to uv#489

Merged
sksat (sksat) merged 2 commits into
mainfrom
feature/migrate-rye-to-uv
Jun 11, 2026
Merged

chore(pytest): migrate Python tooling from rye to uv#489
sksat (sksat) merged 2 commits into
mainfrom
feature/migrate-rye-to-uv

Conversation

@sksat

Copy link
Copy Markdown
Member

概要

pytest 環境の Python ツーリングを rye から uv に移行する

Issue

  • なし(rye は maintenance mode に入っており,upstream も uv への移行を推奨している)

詳細

  • examples/{mobc,subobc}/src/src_user/test/pyproject.toml を uv 形式に書き換え
    • c2aenum @ file:///${PROJECT_ROOT}/... という rye 独自の直接参照を [tool.uv.sources] の相対 path 指定に置き換え
    • rye 独自の [tool.rye] dev-dependencies を標準 (PEP 735) の [dependency-groups] に置き換え
    • build backend が pdm-backend なのに残っていた死に設定 [tool.hatch.metadata] を削除
    • subobc 側のプロジェクト名がコピペで c2a-example-mobc-pytest のままだったのを修正
  • requirements*.lock を削除し uv.lock を生成
  • CI (pytest.yml): sksat/setup-ryeastral-sh/setup-uv (hash 固定),rye syncuv sync --lockedrye run pytestuv run pytest
  • ドキュメント (development_environment.md, test README) を uv に更新

移行で発覚した rye 時代の問題(すべて解消)

  1. lock への絶対パス焼き込み: 旧 requirements.lock には lock したマシンの絶対パス (file:///home/sksat/...) がコミットされていた.uv.lock は相対パス (directory = "../../src_core/enum-loader") で記録される
  2. requires-python の虚偽宣言: >= 3.7 と宣言していたが c2a-pytest-gaia が >= 3.9 を要求しており,uv のユニバーサル解決がこれを検出.実態に合わせて >= 3.9 に修正
  3. 制約違反の lock: 旧 lock は pytest~=7.2.2 (= <7.3) という宣言に対して pytest 7.4.0 を解決していた.uv は 7.2.2 に正しく解決する

検証結果

  • ローカルで mobc の SILS を起動し,uv 環境 (uv 管理の CPython 3.11.3 + pytest 7.2.2) で uv run pytest -m sils -v ./src_core/system/watchdog_timer ./src_core/system/mode_manager2 passed
  • 全 matrix はこの PR の CI で確認する

影響範囲

  • pytest 環境のセットアップ手順が rye syncuv sync に変わる(C2A 本体・flight code への影響なし)
  • lock を作り直したため依存バージョンは最新側に動いている (requests 2.31→2.34 など)
  • CI は uv sync --locked になったため,今後 pyproject.toml だけ変えて lock 更新を忘れると CI が落ちるようになる

補足

Python 3.11.3 の固定は従来どおり .python-version で行われ,uv が実行時に自動取得するため CI に setup-python 系のステップは不要

🤖 Generated with Claude Code

rye is in maintenance mode and its upstream recommends uv. This also
fixes two latent issues rye could not catch:

- requirements*.lock baked in machine-local absolute paths for the
  c2aenum path dependency; uv.lock records it as a relative path
- requires-python claimed >= 3.7 but c2a-pytest-gaia requires >= 3.9,
  and the locked pytest 7.4.0 violated the pytest~=7.2.2 constraint;
  uv resolves both correctly

CI now uses astral-sh/setup-uv and `uv sync --locked`, which fails if
pyproject.toml and uv.lock drift apart. Python 3.11.3 is still pinned
via .python-version and fetched by uv on demand.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 10, 2026 12:36
@sksat sksat (sksat) self-assigned this Jun 10, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR migrates the pytest-focused Python tooling used by the examples/mobc and examples/subobc environments from rye to uv, updating project metadata, lockfiles, CI, and related documentation so dependency resolution is reproducible and aligned with uv’s workflow.

Changes:

  • Converted the two pytest pyproject.toml files from rye-specific configuration to uv-compatible configuration (dependency groups + [tool.uv.sources] for local c2aenum).
  • Replaced the two requirements*.lock lockfiles with uv.lock for both examples.
  • Updated CI (pytest.yml) and development docs to use uv sync / uv run.

Reviewed changes

Copilot reviewed 5 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
examples/subobc/src/src_user/test/uv.lock Adds uv lockfile for subobc pytest environment.
examples/subobc/src/src_user/test/requirements.lock Removes rye-generated lockfile.
examples/subobc/src/src_user/test/requirements-dev.lock Removes rye-generated dev lockfile.
examples/subobc/src/src_user/test/pyproject.toml Migrates subobc pytest project config to uv (sources + dependency-groups) and fixes project name / Python version constraint.
examples/mobc/src/src_user/test/uv.lock Adds uv lockfile for mobc pytest environment.
examples/mobc/src/src_user/test/requirements.lock Removes rye-generated lockfile.
examples/mobc/src/src_user/test/requirements-dev.lock Removes rye-generated dev lockfile.
examples/mobc/src/src_user/test/README.md Updates local setup/run instructions from rye to uv.
examples/mobc/src/src_user/test/pyproject.toml Migrates mobc pytest project config to uv (sources + dependency-groups) and updates Python version constraint.
docs/development/development_environment.md Updates development environment documentation from rye to uv.
.github/workflows/pytest.yml Switches CI from setup-rye/rye sync+run to setup-uv/uv sync --locked + uv run.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread examples/mobc/src/src_user/test/README.md Outdated
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@sksat sksat (sksat) merged commit cb98006 into main Jun 11, 2026
36 checks passed
@sksat sksat (sksat) deleted the feature/migrate-rye-to-uv branch June 11, 2026 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants