Skip to content

Preview gp-sphinx#36 curated default-value rendering#668

Open
tony wants to merge 13 commits into
masterfrom
improved-defaults-reprs
Open

Preview gp-sphinx#36 curated default-value rendering#668
tony wants to merge 13 commits into
masterfrom
improved-defaults-reprs

Conversation

@tony
Copy link
Copy Markdown
Member

@tony tony commented May 9, 2026

Summary

  • Preview branch for git-pull/gp-sphinx#36, which curates parameter and data-attribute default-value rendering across the workspace. This PR pulls the gp-sphinx-family deps from that branch via [tool.uv.sources] so the docs build picks up the changes before a release bump propagates them via PyPI.
  • Empirical impact (libtmux): the audit drops from 171 ugly parameter defaults to 0. Method signatures like Pane._show_option(scope=<libtmux.constants._DefaultOptionScope object>, …) now render as Pane._show_option(scope=DEFAULT_OPTION_SCOPE, …) with DEFAULT_OPTION_SCOPE linked to the documented constant in the same <a class="reference internal"><code class="xref py py-class">…</code></a> HTML shape that inline :py:class: roles produce. Hook dataclass __init__ defaults stop showing =<factory> and instead render =[], ={}, =set(), etc.
  • Includes a [DO NOT MERGE] commit that adds the branch to .github/workflows/docs.yml's on.push.branches list so the live docs site previews the branch. Revert that commit before merging.

After gp-sphinx>=0.0.1a18 ships, replace this with a normal version bump (0.0.1a170.0.1a18 across the four pinned gp-sphinx-family packages) and revert both commits in this branch.

Test plan

  • uv lock resolves all gp-sphinx-family workspace siblings to commit 8c3a1418 on the branch
  • uv sync --all-extras --dev clean install from git sources
  • Local docs rebuild succeeds: cd docs && just html
  • Audit script confirms zero ugly parameter defaults: uv run python ../gp-sphinx/packages/sphinx-autodoc-typehints-gp/scripts/audit_defaults.py libtmux=docs/_build/html
  • Visual spot-check: Pane._show_option, Pane._show_hook, hook dataclass __init__ signatures
  • CI: docs workflow runs against this branch (enabled by the [DO NOT MERGE] commit) and publishes to the docs site for live preview

@codecov
Copy link
Copy Markdown

codecov Bot commented May 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 47.11%. Comparing base (be21aee) to head (367114a).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #668      +/-   ##
==========================================
+ Coverage   47.02%   47.11%   +0.09%     
==========================================
  Files          23       23              
  Lines        3296     3296              
  Branches      709      709              
==========================================
+ Hits         1550     1553       +3     
+ Misses       1384     1381       -3     
  Partials      362      362              

☔ 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 added 12 commits May 10, 2026 20:16
…ources

why: gp-sphinx PR git-pull/gp-sphinx#36 ships curated parameter and
data-attribute default rendering (source-text reprs, dataclass
factory resolution, long-value truncation, and `:py:class:`-styled
cross-reference links inside default values). Pinning the
gp-sphinx-family deps to that branch via `[tool.uv.sources]` lets
this repo's docs preview the user-visible win before the workspace
release bump propagates the changes via PyPI. After the audit,
libtmux's `<libtmux.constants._DefaultOptionScope object>` defaults
across `Pane._show_option`, `Window._show_option`,
`Session._show_option`, hook dataclasses, etc. drop from 171 ugly
sig-params to 0; `scope=` renders as `DEFAULT_OPTION_SCOPE` linked
to the documented constant.

what:
- Add `[tool.uv.sources]` overrides for gp-sphinx,
  sphinx-autodoc-typehints-gp, sphinx-autodoc-api-style, and
  sphinx-autodoc-pytest-fixtures, all pointing at the
  `improved-defaults-reprs` branch with the appropriate
  monorepo subdirectory.
- Regenerate `uv.lock`; uv resolves all transitive workspace
  siblings (sphinx-fonts, sphinx-gp-opengraph,
  sphinx-ux-autodoc-layout, etc.) from the same commit.
- Revert this commit when gp-sphinx>=0.0.1a18 lands and the
  per-package version pins move forward in the usual workspace
  bump.
why: Lets the docs pipeline build and publish from this branch so
the gp-sphinx#36 preview is reviewable on the live docs site
without merging first. Revert this commit before merging the
preview to master.

what:
- Add `improved-defaults-reprs` to the on.push.branches list in
  .github/workflows/docs.yml so the publish job runs for this
  branch's pushes.
why: `DEFAULT_OPTION_SCOPE` is the sentinel default for the `scope=`
parameter on every option-related helper (Pane._show_option,
Server.show_options, Window._set_options_raw, …). Without a docstring
on the assignment Sphinx's autodoc skips it under
`automodule :members: undoc-members:`, so the docs site has no
`#libtmux.constants.DEFAULT_OPTION_SCOPE` anchor — and any default-
value cross-reference in those signatures has no target to link to.
Adding the attribute docstring (PEP 258 — module-attribute docstring
picked up by `ModuleAnalyzer.attr_docs`) gives the sentinel a docs
entry and lets the gp-sphinx default-value xref transform render
`scope=DEFAULT_OPTION_SCOPE` as a clickable link to the documented
constant on `api/libtmux.constants/`.

Also promote `_DefaultOptionScope`'s `# Sentinel value for default
scope` comment to a proper docstring; the class already shows up as
a documented entry on the constants page (per the autodoc default
options) and a real docstring describes the sentinel pattern more
clearly than the stub comment.

what:
- Add an attribute docstring to `DEFAULT_OPTION_SCOPE` describing the
  sentinel semantics and the per-receiver scope inference rule.
- Replace `_DefaultOptionScope`'s stub comment with a class
  docstring describing the sentinel-type role and pointing at the
  lone documented instance.
why: gp-sphinx PR #36 commit `efd4b12` switches the default-value
cross-reference transform from `reftype="class"` to `reftype="obj"`,
so module-level data attributes (like libtmux's
`DEFAULT_OPTION_SCOPE`) now resolve and render as clickable links
instead of misleading-styled unresolved spans. The lock previously
pinned `8c3a1418` (Stage C with the broken class-only reftype); this
refresh moves every gp-sphinx-family entry forward to `efd4b12`.

what:
- Re-resolve every gp-sphinx-family git source (`gp-sphinx`,
  `sphinx-autodoc-typehints-gp`, `sphinx-autodoc-api-style`,
  `sphinx-autodoc-pytest-fixtures`, plus the transitive workspace
  siblings sphinx-fonts, sphinx-gp-{opengraph,sitemap,theme},
  sphinx-ux-{autodoc-layout,badges}, gp-furo-theme) at commit
  `efd4b12`. No other deps move.
…uild

why: While gp-sphinx-family deps resolve from the
improved-defaults-reprs branch via [tool.uv.sources], uv builds
gp-furo-theme from source — its PEP 517 backend is
sphinx-vite-builder, which runs pnpm install + vite build at install
time. CI runners have no pnpm/Node, so the install fails. Revert
this and the uv.sources block once gp-sphinx>=0.0.1a18 publishes.

what:
- tests.yml: add pnpm/action-setup@v6 + setup-node@v6 before each
  uv sync step (build job, release job)
- docs.yml: same, gated on env.PUBLISH == 'true' to mirror the
  surrounding steps
why: setup-node's cache:pnpm option requires a pnpm-lock.yaml at
the consumer repo root. Our pnpm-lock.yaml lives inside the
gp-furo-theme git-source checkout, not in libtmux. Without the
cache option, setup-node still places node on PATH and pnpm runs
fine — just without the GH Actions cache layer.

what:
- tests.yml + docs.yml: drop `cache: pnpm` from each Set up Node
  step
@tony tony force-pushed the improved-defaults-reprs branch from b5c6cdf to bff95f5 Compare May 11, 2026 01:16
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.

1 participant