Upgrade dev tooling and fix docstring style

Merged
MA
3mo ago
+207-168

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Changes To Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?

Description

This PR upgrades locked dev tooling and addresses linting issues introduced by the new versions:

Tooling upgrades:

  • ruff 0.15.12 → 0.16.2
  • pyright 1.1.408 → 1.1.411
  • typer 0.25.1 → 0.27.1

Key changes:

  1. Property docstring style (ruff D421): Updated all property docstrings from imperative form ("Get the ...", "Return the ...") to noun phrases ("The ..."). This applies across:

    • reflex/app.py
    • reflex/compiler/compiler.py
    • reflex/experimental/client_state.py
    • reflex/istate/
    • packages/reflex-base/src/reflex_base/ (vars, event, config, registry, plugins)
    • packages/reflex-components-core/src/reflex_components_core/
    • packages/reflex-docgen/src/reflex_docgen/
    • packages/reflex-components-internal/src/reflex_components_internal/
  2. Type safety improvements:

    • Added cast() calls in reflex/compiler/compiler.py and reflex/reflex.py for untyped libsass and typer APIs
    • Fixed type annotation in packages/reflex-base/src/reflex_base/vars/base.py for default_value with explanatory comment
    • Removed redundant EventSpec import from TYPE_CHECKING block in packages/reflex-base/src/reflex_base/event/processor/base_state_processor.py
    • Changed chain_updates() parameter type from EventSpec | list[EventSpec] | None to Any with updated docstring explaining runtime validation
  3. Code quality fixes:

    • Simplified condition in packages/reflex-base/src/reflex_base/utils/types.py (removed redundant cls is not None check)
    • Fixed import organization in packages/reflex-base/src/reflex_base/vars/datetime.py (moved ImportVar to correct location)
    • Improved control flow in packages/reflex-base/src/reflex_base/vars/dep_tracking.py (split compound condition for clarity)
  4. Test infrastructure:

    • Created tests/units/reflex_cli/v2/utils.py with as_click_command() helper to reduce duplication across CLI tests
    • Updated all CLI test files to use the new helper
    • Removed redundant scope="function" parameter from pytest_asyncio.fixture decorators (already set by loop_scope)
  5. Linting configuration:

    • Added ASYNC119 to ignore list (background event handlers hold async with self across yield by design)
    • Added RUF075 to ignore list (state managers deliberately skip write-back when with body raises)
    • Added RUF105 and RUF201 to ignore list (preserve noqa comment readability)

Test Plan

Existing unit tests pass. The changes are primarily:

  • Docstring style updates (no functional impact)
  • Type annotations and casts for better type checking
  • Test infrastructure refactoring (DRY principle)
  • Linting configuration updates

All changes maintain backward compatibility and improve code quality without altering runtime behavior.

https://claude.ai/code/session_01RLumacyNrCZDqvyptaVxkE