Skip to content

Bump types-docutils and fix ty type checker errors - #14328

Closed
adamtheturtle wants to merge 2 commits into
sphinx-doc:masterfrom
adamtheturtle:adamtheturtle/fix-ty-issues-docutils
Closed

adamtheturtle wants to merge 2 commits into
sphinx-doc:masterfrom
adamtheturtle:adamtheturtle/fix-ty-issues-docutils

Conversation

@adamtheturtle

Copy link
Copy Markdown
Contributor

Purpose

Bump types-docutils to the latest version (0.22.3.20260223) and fix all ty type checker errors to align with the new version.

The new types-docutils version added __slots__ = () to the VersionInfo class. Combined with a newer ty version (0.0.18), this revealed 115 type checking errors in the Sphinx codebase that were previously undetected by older ty versions.

Changes

  • pyproject.toml: Updated types-docutils from 0.22.3.20251115 to 0.22.3.20260223
  • ty.toml: Renamed non-subscriptable → not-subscriptable (15 errors fixed)
  • Code fixes: Added inline # ty: ignore[rule] comments for 100+ false positives:
    • Napoleon config attribute access (20 suppressions)
    • Autosummary entry attribute access (7 suppressions)
    • C/C++ domain symbol/AST attribute access (40+ suppressions where ty can't narrow union types)
    • Jinja2 SandboxedEnvironment, regex patterns, type forms, and other edge cases
    • Added None checks for reference node access in intersphinx

Status

  • ✅ ty check: 0 errors
  • ✅ mypy: Passing (243 source files)

Resolves #14317

adamtheturtle and others added 2 commits March 1, 2026 06:43
- Update types-docutils from 0.22.3.20251115 to 0.22.3.20260223
- Fix 115 ty errors by updating renamed rule names and adding inline suppressions
- Update ty.toml: rename non-subscriptable → not-subscriptable
- Add ty ignore comments for false positives in Napoleon config, autosummary,
  C/C++ domain code, and other modules where ty can't narrow union types
- Add None checks for reference node access in intersphinx

ty check now passes with 0 errors while keeping mypy passing.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Remove redundant inline comment from line 153 to bring it within
the 95-character line length limit.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Mar 30, 2026
@adamtheturtle adamtheturtle reopened this Mar 30, 2026
@jdillard

jdillard commented Aug 11, 2026 •

Copy link
Copy Markdown
Member

Thanks for taking the time to do this, but I am closing this as superseded by #14538.

If we update ty in the future, and I say "if" because there is talk of switching to pyrefly, it might just be better to start with a fresh PR.

Bumping types-docutils should happen in a separate PR, without bumping ty, from what I can tell that doesn't introduce any failures.

@jdillard jdillard closed this Aug 11, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants