Skip to content

Commit bb7694d

Browse files
committed
vite(fix): Load hooks across Hatchling versions
why: Hatchling 1.32.3 adds a generic parameter to build hooks, so specializing the base class at import time breaks fresh installs. what: - Inherit from the unparameterized interface across Hatchling versions. - Return the concrete ViteBuildHook type from plugin registration. - Document the compatibility fix in CHANGES.
1 parent 76978bc commit bb7694d

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

‎CHANGES‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ $ uv add gp-sphinx --prerelease allow
1818

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

21+
### Fixes
22+
23+
#### `sphinx-vite-builder`: Load the Hatchling hook with newer Hatchling
24+
25+
The `vite` build hook loads with Hatchling 1.32.3, which changes the
26+
build-hook interface's type parameters. Existing Hatchling versions
27+
continue to work.
28+
2129
## gp-sphinx 0.1.0a39 (2026-09-06)
2230

2331
gp-sphinx 0.1.0a39 documents the MCP server a project is actually

‎packages/sphinx-vite-builder/src/sphinx_vite_builder/hatch_plugin.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737
from ._internal.vite import run_vite_build
3838

3939

40-
class ViteBuildHook(BuildHookInterface[t.Any]):
40+
# Hatchling changes its generic arity across supported versions.
41+
class ViteBuildHook(BuildHookInterface): # type: ignore[type-arg]
4142
"""Run ``pnpm exec vite build`` before each hatchling build target.
4243
4344
Activated via ``[tool.hatch.build.hooks.vite]`` in a consumer's
@@ -69,7 +70,7 @@ def initialize(self, version: str, build_data: dict[str, t.Any]) -> None:
6970

7071

7172
@hookimpl
72-
def hatch_register_build_hook() -> list[type[BuildHookInterface[t.Any]]]:
73+
def hatch_register_build_hook() -> list[type[ViteBuildHook]]:
7374
"""Hatchling plugin entry point.
7475
7576
Discovered via the ``[project.entry-points.hatch] vite = ...``

0 commit comments

Comments
 (0)