Skip to content

Conversation

@tony
Copy link
Member

@tony tony commented Dec 6, 2025

Problem

Various sphinx warnings on build. Let's tackle those.

@codecov
Copy link

codecov bot commented Dec 6, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 44.46%. Comparing base (e2a91de) to head (4747050).
⚠️ Report is 38 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #612   +/-   ##
=======================================
  Coverage   44.46%   44.46%           
=======================================
  Files          22       22           
  Lines        2305     2305           
  Branches      362      362           
=======================================
  Hits         1025     1025           
  Misses       1133     1133           
  Partials      147      147           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tony tony force-pushed the docstring-fixes branch 2 times, most recently from 92ec7bf to f6fdc4f Compare December 6, 2025 12:34
tony added 2 commits December 6, 2025 06:48
why: Make pathlib available at documentation build time for type hints
what:
- Move pathlib import from TYPE_CHECKING block to regular imports
- Fixes forward reference resolution in sphinx-autodoc-typehints
why: Ensure consistent parameter documentation in autodoc output
what:
- Add always_document_param_types = True for sphinx-autodoc-typehints
@tony tony force-pushed the docstring-fixes branch 2 times, most recently from 3da480d to a79735c Compare December 6, 2025 14:10
@tony tony marked this pull request as ready for review December 6, 2025 14:13
@tony
Copy link
Member Author

tony commented Dec 6, 2025

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

@tony tony force-pushed the docstring-fixes branch 3 times, most recently from 38c0ad5 to 90ebcee Compare December 6, 2025 16:42
tony added 9 commits December 6, 2025 10:52
why: Sphinx/myst was warning about jumping from H2 to H4
what:
- Change #### (H4) subsection headers to ### (H3) in both files
  for proper header level hierarchy (H1 -> H2 -> H3)
why: Myst was warning about duplicate markdown reference definitions
what:
- Remove duplicate [uv] reference in developing.md
- Remove duplicate [uv] reference in CHANGES
- Remove duplicate [ptpython] reference in quickstart.md
why: Forward references in TYPE_CHECKING blocks cannot be resolved at
     doc build time, causing ~69 warnings that obscure other issues
what:
- Add suppress_warnings config to hide forward_reference warnings
- These warnings are cosmetic - types like Self, Server, Session are
  used as string forward references to avoid circular imports
…liance

why: Sphinx/Napoleon requires proper field list structure to avoid
"Field list ends without a blank line" warnings when processing NumPy-style
docstrings.

what:
- Add Raises sections to EnvironmentMixin methods (common.py)
- Add Returns sections to capture_pane, display_message, set_width, set_height (pane.py)
- Fix attached_sessions Returns format (server.py)
- Add Raises section to kill_window (session.py)
- Add Returns/Raises sections to split, select_layout, move_window (window.py)
- Standardize parameter descriptions (capitalize, add periods)
why: Dataclasses without docstrings cause "Inline strong start-string
without end-string" warnings. Citation syntax [1]_ not resolving properly.

what:
- Add docstrings to ServerOptions, SessionOptions, WindowOptions,
  PaneOptions, Options dataclasses (constants.py)
- Simplify EnvironmentVarGuard docstring, convert citation to inline URL
  (environment.py)
why: Sphinx warns about duplicate labels, undefined references, and
strikethrough syntax not supported in non-HTML output.

what:
- Remove duplicate (internals)= label from about.md
- Add (setting_a_tmux_configuration)= label and fix reference in pytest-plugin/index.md
- Replace ~~strikethrough~~ with italicized note in CHANGES
why: sphinx-autodoc-typehints was injecting :type: and :rtype: directives
into docstrings at runtime, causing "Unexpected indentation" errors due to
RST field list parsing conflicts with Napoleon-processed docstrings.

what:
- Change autodoc_typehints from "description" to "signature"
- Set always_document_param_types = False to disable param type injection
- Set typehints_document_rtype = False to disable return type injection
- Type hints are now visible in function signatures only

This eliminates all 64 anonymous "Unexpected indentation" errors while
maintaining type documentation in the API reference.
…message

why: The return type annotations incorrectly included `str` as a possible
return type, but the implementation only ever returns `list[str]`.
what:
- Change capture_pane() return type from `str | list[str]` to `list[str]`
- Change display_message() return type from `str | list[str] | None` to `list[str] | None`
- Update corresponding docstring Returns sections
…ypehints

why: Types in TYPE_CHECKING blocks (used for circular import avoidance)
cause sphinx-autodoc-typehints to emit warnings about unresolvable forward
references. These warnings are expected and safe to suppress.
what:
- Add suppress_warnings config for sphinx_autodoc_typehints.forward_reference
tony added 3 commits December 6, 2025 10:53
why: Sphinx warns about duplicate object descriptions when the same module
is referenced in multiple documentation files.
what:
- Add :no-index: directive to module blocks in windows.md, pytest-plugin/index.md,
  and quickstart.md to prevent duplicate indexing
why: Users relying on type hints should know about the corrected return types.
what:
- Add changelog entry for capture_pane() and display_message() type fixes
@tony tony merged commit 1b77683 into master Dec 6, 2025
14 checks passed
@tony tony deleted the docstring-fixes branch December 6, 2025 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants