Skip to content

Prefer the Caller's Venv Ruff and Pyright in the Validate Lint Job for a Pip Directory #2850

Closed

Description

@ptr727

Problem

The lint job runs a floating uvx ruff@latest for a declared pip (requirements.txt) directory, where a uv directory uses the project's locked ruff:

  • .github/workflows/validate-task.yml:350-352: uv run ruff check . for uv, uvx ruff@latest check . otherwise.
  • .github/workflows/validate-task.yml:366-368: the same split for ruff format --check.

The type-check step is inconsistent with that. For a pip directory with mypy it prefers the venv's own copy when installed (validate-task.yml:436-439, "$venv_python" -m mypy) and falls back to uvx mypy@latest only when absent (:446).

Pyright does not behave like mypy. For a declared pip directory it always runs uvx pyright@latest --pythonpath "$venv_python" (validate-task.yml:448-449), never the venv's own copy, even when the requirements pin one. So ruff and pyright float, and only mypy follows the venv.

Impact

A new ruff or pyright release can fail CI while the devcontainer, which installs the pinned version from the requirements file, passes. The caller cannot pin either tool for a pip directory. The comment at validate-task.yml:292-293 justifies @latest because "a uvx pin is nothing Dependabot tracks", but a version pinned in the caller's requirements file is tracked by its own pip Dependabot ecosystem, so the justification does not hold when the venv already carries the tool.

Suggested fix

For a declared pip directory, prefer the venv's installed ruff and pyright (a find_spec or executable check, as the mypy branch does) and fall back to uvx <tool>@latest only when the venv does not carry it. Document the precedence next to the existing mypy note.

Found while: adopting validate-task.yml in ptr727/homeassistant-purpleair

🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    script

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions