Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
7b85c6b
chore(typehints-gp[defaults-audit]) Probe script + D1 discovery findings
tony May 9, 2026
4a90861
feat(gp-sphinx[autodoc]) Default autodoc_preserve_defaults to True
tony May 9, 2026
198ab5b
feat(typehints-gp[param-defaults]) Resolve dataclass __init__ defaults
tony May 9, 2026
9c49ffb
feat(typehints-gp[data-defaults]) Truncate long :value: text
tony May 9, 2026
081f566
feat(typehints-gp[default-xref]) Cross-reference identifiers in defau…
tony May 9, 2026
ed2d7a1
refactor(typehints-gp[resolvers]) Factor shared catalog into _resolvers
tony May 9, 2026
340796d
fix(typehints-gp[default-xref]) Use reftype=obj so data attrs resolve
tony May 9, 2026
81ee842
fix(typehints-gp[default-xref]) Resolve cross-module + skip undocumented
tony May 10, 2026
9acd353
feat(typehints-gp[field-xref]) Canonicalise Python xrefs in autodoc f…
tony May 10, 2026
74decb8
docs(typehints-gp[examples]) Vibrant showcase for branch coverage
tony May 10, 2026
cf032fc
test(typehints-gp[field-xref]) Module-scope lambda-default fixture
tony May 10, 2026
90a47af
typehints-gp(polish[review-residue]) Address residual code-review nits
tony May 10, 2026
381e414
typehints-gp(css[field-prefix]) Clamp field-list prefix to 0.8125rem
tony May 10, 2026
6000978
typehints-gp(css[field-list]) Clamp dd body to 0.8125rem too
tony May 10, 2026
c797297
gp-furo-tokens(feat[type-roles]) Add four gp-sphinx-type-* role aliases
tony May 10, 2026
5046274
gp-furo-theme(css[layer-order]) Declare gp-sphinx cascade layer
tony May 10, 2026
5b5e7af
sphinx-gp-theme(css[toc]) Fix inert :root TOC override; move to body
tony May 10, 2026
399afe6
sphinx-ux-badges(css[icon]) Replace 10px absolute with role token; layer
tony May 10, 2026
062874a
ux-autodoc-layout(css[field-list]) Authoritative wrapper-aware grid +…
tony May 10, 2026
55f8da0
sphinx-autodoc-api-style(css[field-list]) Relabel direct-child rules …
tony May 10, 2026
33f4638
sphinx-autodoc-pytest-fixtures(css[field-list]) Standalone fallback f…
tony May 10, 2026
9b82e75
sphinx-autodoc-typehints-gp(css[field-prefix]) Field prefix inherits …
tony May 10, 2026
2d100d0
gp-furo-theme(css[scaffold]) Replace 110% root cliff with clamp() ramp
tony May 10, 2026
66e1bec
ux-autodoc-layout(css[field-list]) Drop dd to metadata size; flex-gap…
tony May 10, 2026
d097048
typehints-gp(css[field-prefix]) Reserve monospace for code identifier…
tony May 10, 2026
70c6ebe
typehints-gp(css[code-chip]) Restore Furo chip styling on field-list …
tony May 10, 2026
362b3fd
typehints-gp(css[code-chip]) Drop chip side-padding inside field lists
tony May 10, 2026
9f28a52
typehints-gp(css[field-prefix]) Drop mono on <strong>; sans-bold para…
tony May 10, 2026
6330ea7
ux-autodoc-layout(css[field-list]) Margin symmetry on direct <dd> > <p>
tony May 10, 2026
15abf03
ux-autodoc-layout+api-style(css[field-list-bullets]) Cancel Furo's ne…
tony May 10, 2026
215c99c
ux-autodoc-layout(css[mobile-header]) Pin type badge left of signatur…
tony May 10, 2026
ddfe5fa
ux-autodoc-layout+api-style+pytest-fixtures(css[field-list]) Move dd …
tony May 10, 2026
c431d4f
docs(CHANGES) Curated default rendering and autodoc typography polish
tony May 10, 2026
ae1fb1a
docs+fix(sphinx-vite-builder) Drop cache: pnpm from default CI hint
tony May 10, 2026
018f4e3
gp-sphinx(feat[linkcode]) Add make_workspace_linkcode_resolve for mon…
tony May 10, 2026
526b9ae
ux-autodoc-layout(css[mobile-stack]) Stack header rows below 52rem in…
tony May 10, 2026
43954b2
ux-autodoc-layout(css[narrow-source-right]): Right-anchor source link…
tony May 10, 2026
8179bc0
ux-autodoc-layout(css[narrow-permalink]): Reveal hover-only permalink…
tony May 10, 2026
b03e3d6
ux-autodoc-layout(css[tiny-hscroll]): Swap character-wrap for horizon…
tony May 10, 2026
ce92d7a
ux-autodoc-layout(feat[dual-variant]) Emit desktop+mobile headers und…
tony May 11, 2026
817364b
ux-autodoc-layout(css[no-header-transitions]): Cancel Furo's .sig tra…
tony May 11, 2026
5055f06
docs(CHANGES) Workspace linkcode helper, responsive autodoc layout, a…
tony May 11, 2026
c2a9ac6
docs(CHANGES) Add 0.0.1a18 lead paragraphs and pin target version
tony May 11, 2026
6dd623e
release(workspace): bump v0.0.1a17 → v0.0.1a18.dev0
tony May 11, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 94 additions & 1 deletion CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,103 @@ $ pip install --user --upgrade --pre gp-sphinx
$ uv add gp-sphinx --prerelease allow
```

## gp-sphinx 0.0.1 (unreleased)
## gp-sphinx 0.0.1a18 (unreleased)

<!-- To maintainers and contributors: Please add notes for the forthcoming version below -->

gp-sphinx 0.0.1a18 ships curated autodoc rendering across the docs
surface. Parameter signatures now resolve default values to their
source text — including dataclass `__init__` synthetic defaults,
sentinel constants by name, and identifier defaults wired up as
live cross-references to their documented class. Type expressions
in autodoc field lists route through the same xref pipeline so
links and chip styling stay consistent with the signature.

The autodoc layout adapts to narrow viewports with a dual-variant
header: below 52rem the header row stacks instead of squeezing, and
below 30rem long signatures scroll horizontally instead of wrapping
mid-identifier. A new `gp-sphinx` cascade layer makes workspace
overrides win over Furo declaratively, and parameter and field-list
typography unify into a single metadata-sized band.

A workspace-wide `linkcode_resolve` factory now covers every
uv/pnpm monorepo package with one registration, pointing at the
configured live tip branch rather than per-package version tags.

### What's new

#### `gp-sphinx`: Curated default-value rendering for autodoc

`autodoc_preserve_defaults=True` is now the workspace default, and a
new listener fills the synthetic `__init__` gap so dataclass
parameters render as `=[]` instead of `=<factory>`, and sentinel
constants render as their source name (e.g.
`scope=DEFAULT_OPTION_SCOPE`) instead of `<...object at 0x...>`.
Long `:value:` text is collapsed so multi-KB constants no longer
dominate API pages while short useful values stay intact.
Identifier defaults inside parameter signatures become live
cross-references to their documented class — the resulting HTML
matches an inline `:py:class:` role, so hand-written
`.. py:function::` directives benefit too. (#36)

#### `sphinx-autodoc-typehints-gp`: Canonical Python xrefs in field lists

Type expressions in autodoc field lists route through the same
xref pipeline as the signature, so links resolve consistently and
nested types render with chip styling that matches the rest of the
page. (#36)

#### Autodoc typography polish across the docs surface

Parameter and field-list rows share a unified metadata-sized
typography band across the autodoc stack. Code chips sit flush
against generic-type brackets, parameter names use sans-bold while
monospace is reserved for code identifiers, and root-level scaling
on wide viewports follows a `clamp()` ramp instead of stepping up
at a single breakpoint. A new `gp-sphinx` cascade layer makes
workspace overrides win over Furo declaratively rather than via
unlayered precedence. (#36)

#### `gp-sphinx`: Workspace-wide `linkcode_resolve` factory

`make_workspace_linkcode_resolve()` is a drop-in `linkcode_resolve`
for uv/pnpm monorepos — one registration covers every package under
`packages/` by computing GitHub URLs relative to a `repo_root`. The
generated URLs always point at a single configurable branch
(default `main`), since workspace packages carry independent
versions while the docs site tracks live tip. (#36)

#### `sphinx-ux-autodoc-layout`: Responsive autodoc headers on narrow viewports

Below 52rem the header row stacks instead of squeezing, with the
type badge pinned beside the signature and the source link
right-anchored in its toolbar. Below 30rem long signatures scroll
horizontally rather than wrapping mid-identifier, and the permalink
reveals on tap for touch users. (#36)

### Bug fixes

#### `sphinx-gp-theme`: TOC font-size override now applies

The override for `--toc-font-size` and `--toc-title-font-size` was
inert because `gp-furo-tokens` emits the default values on `body`,
not `:root`. The sidebar TOC now picks up the configured larger
size. (#36)

#### `sphinx-ux-autodoc-layout`: Mobile header keeps the type badge beside the signature

On narrow viewports the type badge previously wrapped below the
signature, breaking the eyebrow-style layout. It now stays pinned
to the left of the signature row. (#36)

#### `sphinx-vite-builder`: CI setup hint no longer requires a root lockfile

The recipe printed by `PnpmMissingError` (and the matching
README/AGENTS samples) used to include `cache: pnpm`, which fails
on consumer CI with "Dependencies lock file is not found" when the
consumer repo has no root `pnpm-lock.yaml`. The hint now omits that
line, with a note explaining when it is safe to add back. (#36)

## gp-sphinx 0.0.1a17 (2026-05-09)

### What's new
Expand Down
127 changes: 127 additions & 0 deletions docs/_ext/api_demo_typehints_gp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
"""Demo module for sphinx-autodoc-typehints-gp showcase.

Exercises every rendering improvement landed on the
``improved-defaults-reprs`` branch — source-text defaults, dataclass
factory rendering, long-data truncation, cross-referenced default
values, field-list xref styling, and the prefix monospace wrapper.
Each documented object below is referenced from
``docs/packages/sphinx-autodoc-typehints-gp/examples.md`` so the HTML
output renders with all transforms active.
"""

from __future__ import annotations

import dataclasses
import enum


class CacheScope(enum.Enum):
"""Where a cached entry lives in the storage hierarchy."""

Process = "process"
Session = "session"
Global = "global"


class _DefaultRetry:
"""Sentinel type for the ``retry=`` parameter's default value."""


DEFAULT_RETRY: _DefaultRetry = _DefaultRetry()
"""Sentinel default for ``retry=`` parameters on connection helpers.

When ``retry is DEFAULT_RETRY`` the helper picks a transport-aware
retry policy from the bound transport's ``retry_policy`` attribute.
"""


SHORT_DEFAULT: str = "admin"
"""A short, readable module-level constant — renders as-is."""


LONG_DEFAULT_RULES: list[tuple[str, str]] = [
(f"rule-{i:02d}", f"description for rule number {i}") for i in range(20)
]
"""A long ``list[tuple[str, str]]`` used as a documented constant.

The ``repr()`` exceeds the 200-char threshold so the rendered
``:value:`` collapses to ``<...truncated, N chars>`` instead of
sprawling across the page.
"""


class ConnectionFailure(Exception):
"""Raised when a connection attempt fails after exhausting retries."""


class Transport:
"""Documented internal transport — referenced as a parameter type."""


@dataclasses.dataclass
class HookCounters:
"""Dataclass exercising every default-factory shape.

Each field uses ``field(default_factory=...)`` with a stdlib
container type or a custom callable. After the synthetic-init
listener runs, the rendered ``__init__`` signature shows the
factory call source text instead of ``=<factory>``.
"""

alerts: list[str] = dataclasses.field(default_factory=list)
index: dict[str, int] = dataclasses.field(default_factory=dict)
names: set[str] = dataclasses.field(default_factory=set)
tags: tuple[str, ...] = dataclasses.field(default_factory=tuple)
transports: list[Transport] = dataclasses.field(default_factory=list)


def open_session(
transport: Transport,
*,
scope: CacheScope = CacheScope.Session,
retry: _DefaultRetry = DEFAULT_RETRY,
label: str = "default",
) -> Transport:
"""Open a session against *transport*.

The ``scope`` and ``retry`` defaults both reference documented
targets on this same page; Stage C's xref transform turns each
documented identifier inside a default-value span into a
clickable cross-reference using the canonical
``:py:obj:``-styled HTML shape (``<a class="reference internal"
href="…"><code class="xref py py-obj">…</code></a>``).

Parameters
----------
transport : Transport
The documented transport instance.
scope : CacheScope
Scope at which session state is cached.
retry : _DefaultRetry
Retry sentinel; pass an explicit policy to override.
label : str
Optional label propagated to log records.

Returns
-------
Transport
The same transport, now bound to the session.

Raises
------
ConnectionFailure
Raised when the transport cannot be opened after the retry
policy is exhausted.
"""
return transport


def with_lambda_default(callback: object = lambda: None) -> None:
"""Demonstrate Stage C's plain-text fallback for lambda defaults.

``ast.parse`` of the default succeeds but the lambda branch isn't
handled by the xref transform; the rendered default sits as plain
text inside the ``default_value`` span (no spurious ``<code
class="xref">`` styling that would imply a missing link target).
"""
del callback
19 changes: 15 additions & 4 deletions docs/_static/css/custom.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/* All workspace overrides land in @layer gp-sphinx so precedence is
* declarative against Furo's @layer components rather than relying
* on accidental "unlayered wins." Layer order is established in
* gp-furo-theme/web/src/styles/index.css. */
@layer gp-sphinx {

.sidebar-tree p.indented-block {
padding: var(--sidebar-item-spacing-vertical) var(--sidebar-item-spacing-horizontal) 0
var(--sidebar-item-spacing-horizontal);
Expand Down Expand Up @@ -109,10 +115,13 @@ article h6 {
* Uses Furo CSS variable overrides where possible.
* ────────────────────────────────────────────────────────── */

/* TOC font sizes: override Furo defaults (75% → 87.5%) */
:root {
--toc-font-size: var(--font-size--small); /* 87.5% = 14px */
--toc-title-font-size: var(--font-size--small); /* 87.5% = 14px */
/* TOC font sizes: drive from the gp-sphinx-type-metadata role token
* (87.5%, ~14px). Declared on `body` because gp-furo-tokens emits
* Furo's own --toc-font-size on `body` too — a `:root` override is
* silently shadowed for descendants of body. */
body {
--toc-font-size: var(--gp-sphinx-type-metadata);
--toc-title-font-size: var(--gp-sphinx-type-metadata);
}

/* More generous line-height for wrapped TOC entries */
Expand Down Expand Up @@ -553,3 +562,5 @@ article > section > blockquote:has(+ .gp-sphinx-package__landing-grid) {
color: var(--color-foreground-secondary);
margin: 0.5rem 0 1rem 0;
}

} /* end @layer gp-sphinx */
10 changes: 9 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@
sys.path.insert(0, str(cwd / "_ext")) # docs demo modules

import gp_sphinx # noqa: E402
from gp_sphinx.config import merge_sphinx_config # noqa: E402
from gp_sphinx.config import ( # noqa: E402
make_workspace_linkcode_resolve,
merge_sphinx_config,
)

intersphinx_mapping = {
"py": ("https://docs.python.org/3/", None),
Expand All @@ -75,6 +78,11 @@
source_repository=f"{gp_sphinx.__github__}/",
docs_url=gp_sphinx.__docs__,
source_branch="main",
linkcode_resolve=make_workspace_linkcode_resolve(
repo_root=project_root,
github_url=gp_sphinx.__github__,
source_branch="main",
),
extra_extensions=[
"inline_highlight",
"package_reference",
Expand Down
Loading
Loading