Preview gp-sphinx#36 curated default-value rendering#668
Open
Preview gp-sphinx#36 curated default-value rendering#668
Conversation
b14ff20 to
fdb4a8a
Compare
eaa2021 to
61a9ee5
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
…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
b5c6cdf to
bff95f5
Compare
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.
Summary
[tool.uv.sources]so the docs build picks up the changes before a release bump propagates them via PyPI.Pane._show_option(scope=<libtmux.constants._DefaultOptionScope object>, …)now render asPane._show_option(scope=DEFAULT_OPTION_SCOPE, …)withDEFAULT_OPTION_SCOPElinked 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.[DO NOT MERGE]commit that adds the branch to.github/workflows/docs.yml'son.push.brancheslist 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.1a17→0.0.1a18across the four pinned gp-sphinx-family packages) and revert both commits in this branch.Test plan
uv lockresolves all gp-sphinx-family workspace siblings to commit8c3a1418on the branchuv sync --all-extras --devclean install from git sourcescd docs && just htmluv run python ../gp-sphinx/packages/sphinx-autodoc-typehints-gp/scripts/audit_defaults.py libtmux=docs/_build/htmlPane._show_option,Pane._show_hook, hook dataclass__init__signaturesdocsworkflow runs against this branch (enabled by the[DO NOT MERGE]commit) and publishes to the docs site for live preview