chore(ruff): enable four low-risk checks - #10586
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
All contributors have signed the CLA ✍️ ✅ |
Contributor
There was a problem hiding this comment.
No issues found across 8 files
Architecture diagram
sequenceDiagram
participant Config as Config Module
participant Env as Environment Variables
participant TypeSystem as Type System
participant VersionCheck as Python Version Check
participant OpenAPI as OpenAPI Converter
participant Runtime as Runtime Context
participant CacheTest as Cache Test
Note over Config,Env: Configuration defaults handling
Config->>VersionCheck: Check sys.version_info
alt Python >= 3.11
Config->>TypeSystem: Import NotRequired from typing
else Python < 3.11
Config->>TypeSystem: Import NotRequired from typing_extensions
end
Config->>Env: Read MARIMO_OUTPUT_MAX_BYTES
Env-->>Config: String value or "8000000" default
Config->>Config: Convert to int
Config->>Env: Read MARIMO_STD_STREAM_MAX_BYTES
Env-->>Config: String value or "1000000" default
Config->>Config: Convert to int
Note over OpenAPI,TypeSystem: Optional type construction
OpenAPI->>VersionCheck: Check sys.version_info
alt Python >= 3.11
OpenAPI->>TypeSystem: Import NotRequired from typing
else Python < 3.11
OpenAPI->>TypeSystem: Import NotRequired from typing_extensions
end
OpenAPI->>OpenAPI: Build optional_name_overrides dict
Note right of OpenAPI: Uses Optional[arg] at runtime<br/>with intentional suppression
Note over Runtime: Thread-local context management
Runtime->>Runtime: install() context manager
Runtime->>Runtime: Access _THREAD_LOCAL_CONTEXT directly
Runtime->>Runtime: Save and restore old context
Runtime->>Runtime: initialize_context()
Runtime->>Runtime: Access _THREAD_LOCAL_CONTEXT directly
Runtime->>Runtime: Initialize runtime context
Runtime->>Runtime: teardown_context()
Runtime->>Runtime: Access _THREAD_LOCAL_CONTEXT directly
Runtime->>Runtime: Clear runtime context
Note over CacheTest: Global variable behavior test
CacheTest->>CacheTest: Define function with global state
CacheTest->>CacheTest: Explicit global lookup
Note right of CacheTest: Intentional pattern with<br/>scoping test coverage
Contributor
There was a problem hiding this comment.
Pull request overview
This PR tightens marimo’s Ruff configuration by enabling four previously-ignored, low-risk rules and makes small, targeted code changes to satisfy them without altering runtime behavior.
Changes:
- Enables Ruff checks
PLW1508,UP045,PYI066, andPLW0602by removing them from the global ignore list. - Reorders
sys.version_infobranches so the newer-Python import path is first (PYI066), across runtime code and tests. - Addresses two intentional runtime patterns with narrow inline exceptions (
globallookup test + runtimeOptional[...]construction), and fixes env-var defaults to be strings beforeint(...)conversion (PLW1508).
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
pyproject.toml |
Removes ignores for the four Ruff rules to enable them repository-wide. |
marimo/_config/config.py |
Fixes os.getenv defaults to be strings before parsing to int (PLW1508) and updates version-branch ordering for NotRequired. |
marimo/_utils/parse_dataclass.py |
Updates NotRequired import branching to put newer Python first (PYI066). |
marimo/_utils/dataclass_to_openapi.py |
Updates NotRequired import branching (PYI066) and adds a targeted UP045 inline exemption for runtime Optional[...] construction. |
marimo/_utils/narwhals_utils.py |
Simplifies TypeGuard import by removing redundant version branching. |
marimo/_runtime/context/types.py |
Removes unnecessary global declarations where no global assignment occurs (PLW0602). |
tests/_utils/test_parse_dataclass.py |
Mirrors NotRequired import branch ordering change for PYI066. |
tests/_save/test_cache.py |
Adds a targeted PLW0602 inline exemption to preserve an intentional “global lookup” test pattern. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Light2Dark
force-pushed
the
t3code/enable-safe-ruff-rules
branch
from
August 20, 2026 04:55
ca5c861 to
be48e27
Compare
dmadisetti
approved these changes
Aug 20, 2026
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.
This pull request was authored by a coding agent.
Ruff still globally suppresses several checks whose remaining violations are small and mechanical. This enables
PLW1508,UP045,PYI066, andPLW0602while preserving the two intentional runtime patterns with narrow inline exceptions.The changes keep behavior stable: environment defaults remain integers after parsing, Python compatibility imports retain the same version split, and explicit notebook global lookup remains covered by its scoping test.