Skip to content

chore: align local ruff with CI's dependency window#9732

Merged
kirangadhave merged 1 commit into
mainfrom
kg/uv-exclude-newer
May 30, 2026
Merged

chore: align local ruff with CI's dependency window#9732
kirangadhave merged 1 commit into
mainfrom
kg/uv-exclude-newer

Conversation

@kirangadhave
Copy link
Copy Markdown
Member

Problem

make py-check runs uv run ruff check --fix, which re-resolves ruff rather than using a frozen lock (uv.lock is gitignored). Locally there was no upper bound, so it floated to whatever ruff uv resolved at setup time. CI's lint job (test_check in test_be.yaml) runs the same command but with UV_EXCLUDE_NEWER: "7 days", so CI resolves the latest ruff aged >= 7 days.

Concretely: CI resolved ruff <= 0.15.14 (clean tree), while local floated to 0.15.15, which added a new F811 autofix (runtime imports also re-imported under TYPE_CHECKING) and rewrote files CI considered clean.

Fix

Make local resolution reproduce CI's window at setup time:

  • pyproject.toml: add [tool.uv] exclude-newer = "7 days", mirroring CI's UV_EXCLUDE_NEWER. Local uv run/uv lock now resolve the same versions CI would resolve when you set up. Point-in-time: a fresh setup matches CI; a stale checkout matches once re-locked.
  • .pre-commit-config.yaml: pin ruff-pre-commit to the version that window currently resolves (v0.15.14), since pre-commit.ci installs from the tag and isn't governed by the window. Renovate (minimumReleaseAge: 7 days) keeps the tag tracking.
  • Commit the autofixes the windowed ruff produces: unused-import removals and type-only imports relocated into TYPE_CHECKING.

No version is hard-pinned; the floor stays ruff>=0.15.9 and the window controls the upper bound.

Verification

  • uv run ruff --version -> 0.15.14 (== pre-commit rev == CI's windowed resolution)
  • uv run ruff check . && uv run ruff format --check . -> clean
  • uvx ruff@0.15.14 check . -> All checks passed
  • uvx pre-commit run ruff-check/ruff-format --all-files -> Passed
  • make py-check -> lint, format, typecheck (713 files), lock all pass
  • All modified modules import cleanly; tests/_runtime/test_manage_script_metadata.py -> 14 passed

Local make py-check ran uv run ruff check --fix, which re-resolves ruff and floated to a newer version than CI's pinned lint, rewriting files CI considered clean. Add [tool.uv] exclude-newer = "7 days" so local resolution mirrors CI's UV_EXCLUDE_NEWER, pin the ruff-pre-commit rev to the resulting version (v0.15.14), and commit the autofixes that version produces.
@vercel
Copy link
Copy Markdown

vercel Bot commented May 30, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
marimo-docs Ready Ready Preview, Comment May 30, 2026 12:54am

Request Review

@kirangadhave kirangadhave added the internal A refactor or improvement that is not user facing label May 30, 2026
@kirangadhave kirangadhave marked this pull request as ready for review May 30, 2026 00:55
Copilot AI review requested due to automatic review settings May 30, 2026 00:55
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 10 files

Architecture diagram
sequenceDiagram
    participant Dev as Developer
    participant Local as Local Environment
    participant CI as CI Pipeline
    participant UV as uv Package Manager
    participant Ruff as Ruff Linter
    participant PreCommit as pre-commit CI

    Note over Dev,PreCommit: Dependency Version Alignment Flow

    Dev->>Local: Run `make py-check`
    Local->>UV: Execute `uv run ruff check --fix`
    UV->>UV: Read pyproject.toml config
    
    alt NEW: [tool.uv] exclude-newer = "7 days"
        UV->>UV: Apply 7-day version window to resolution
        UV->>Ruff: Resolve ruff version within window
        Ruff-->>UV: Return version <= 0.15.14
    else Old behavior (no window)
        UV->>Ruff: Resolve latest ruff version
        Ruff-->>UV: Return version 0.15.15+
    end
    
    UV-->>Local: Provide ruff binary
    Local->>Ruff: Execute linting and formatting
    Ruff-->>Local: Apply autofixes (F811, unused imports)

    Note over CI,PreCommit: CI Pipeline Resolution
    
    CI->>CI: Set UV_EXCLUDE_NEWER="7 days"
    CI->>UV: Execute `uv run ruff check --fix`
    UV->>UV: Apply same 7-day window
    UV->>Ruff: Resolve ruff version within window
    Ruff-->>UV: Return version 0.15.14
    UV-->>CI: Provide ruff binary
    CI->>Ruff: Execute linting and formatting
    Ruff-->>CI: Clean results (matches local)

    Note over PreCommit: Pre-commit Hooks
    
    PreCommit->>PreCommit: Install ruff-pre-commit v0.15.14
    PreCommit->>Ruff: Run ruff-check and ruff-format
    Ruff-->>PreCommit: Results match windowed resolution

    Note over Dev,PreCommit: Result: Local, CI, and pre-commit all use ruff v0.15.14
Loading

Re-trigger cubic

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 aligns local Python dependency resolution with CI’s 7-day uv dependency window, reducing Ruff version drift between local checks, CI linting, and pre-commit.

Changes:

  • Adds [tool.uv] exclude-newer = "7 days" to mirror CI resolution behavior.
  • Updates the Ruff pre-commit hook from v0.15.10 to v0.15.14.
  • Applies Ruff import autofixes by removing duplicate/runtime-only type imports.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pyproject.toml Adds the uv dependency age window used by CI.
.pre-commit-config.yaml Updates the Ruff pre-commit hook revision.
tests/_runtime/test_manage_script_metadata.py Removes a runtime-only type import.
marimo/_utils/narwhals_utils.py Removes a type-only Narwhals runtime import.
marimo/_runtime/complete.py Removes a type-only threading runtime import.
marimo/_plugins/ui/_impl/table.py Moves Callable into the existing type-checking imports.
marimo/_plugins/ui/_impl/dataframes/transforms/handlers.py Removes a type-only Callable runtime import.
marimo/_lint/linter.py Removes type-only collection imports from runtime.
marimo/_ast/app.py Removes a duplicate Sequence type import.
marimo/_ai/_tools/tools/cells.py Removes a duplicate CellData type import.

@kirangadhave kirangadhave merged commit 36fdf3b into main May 30, 2026
101 of 103 checks passed
@kirangadhave kirangadhave deleted the kg/uv-exclude-newer branch May 30, 2026 02:07
@github-actions
Copy link
Copy Markdown

🚀 Development release published. You may be able to view the changes at https://marimo.app?v=0.23.9-dev24

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

Labels

dependencies internal A refactor or improvement that is not user facing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants