sphinx-vite-builder 0.0.1a16.dev0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,233 @@
1
+ # Node
2
+ node_modules/
3
+ *.tsbuildinfo
4
+ .vitest-cache/
5
+
6
+ # Byte-compiled / optimized / DLL files
7
+ __pycache__/
8
+ *.py[codz]
9
+ *$py.class
10
+
11
+ # C extensions
12
+ *.so
13
+
14
+ # Distribution / packaging
15
+ .Python
16
+ build/
17
+ develop-eggs/
18
+ dist/
19
+ downloads/
20
+ eggs/
21
+ .eggs/
22
+ lib/
23
+ lib64/
24
+ parts/
25
+ sdist/
26
+ var/
27
+ wheels/
28
+ share/python-wheels/
29
+ *.egg-info/
30
+ .installed.cfg
31
+ *.egg
32
+ MANIFEST
33
+
34
+ # PyInstaller
35
+ # Usually these files are written by a python script from a template
36
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
37
+ *.manifest
38
+ *.spec
39
+
40
+ # Installer logs
41
+ pip-log.txt
42
+ pip-delete-this-directory.txt
43
+
44
+ # Unit test / coverage reports
45
+ htmlcov/
46
+ .tox/
47
+ .nox/
48
+ .coverage
49
+ .coverage.*
50
+ .cache
51
+ nosetests.xml
52
+ coverage.xml
53
+ *.cover
54
+ *.py.cover
55
+ .hypothesis/
56
+ .pytest_cache/
57
+ cover/
58
+
59
+ # Translations
60
+ *.mo
61
+ *.pot
62
+
63
+ # Django stuff:
64
+ *.log
65
+ local_settings.py
66
+ db.sqlite3
67
+ db.sqlite3-journal
68
+
69
+ # Flask stuff:
70
+ instance/
71
+ .webassets-cache
72
+
73
+ # Scrapy stuff:
74
+ .scrapy
75
+
76
+ # Sphinx documentation
77
+ docs/_build/
78
+
79
+ # PyBuilder
80
+ .pybuilder/
81
+ target/
82
+
83
+ # Jupyter Notebook
84
+ .ipynb_checkpoints
85
+
86
+ # IPython
87
+ profile_default/
88
+ ipython_config.py
89
+
90
+ # pyenv
91
+ # For a library or package, you might want to ignore these files since the code is
92
+ # intended to run in multiple environments; otherwise, check them in:
93
+ # .python-version
94
+
95
+ # pipenv
96
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
97
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
98
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
99
+ # install all needed dependencies.
100
+ #Pipfile.lock
101
+
102
+ # UV
103
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
104
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
105
+ # commonly ignored for libraries.
106
+ #uv.lock
107
+
108
+ # poetry
109
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
110
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
111
+ # commonly ignored for libraries.
112
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
113
+ #poetry.lock
114
+ #poetry.toml
115
+
116
+ # pdm
117
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
118
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
119
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
120
+ #pdm.lock
121
+ #pdm.toml
122
+ .pdm-python
123
+ .pdm-build/
124
+
125
+ # pixi
126
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
127
+ #pixi.lock
128
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
129
+ # in the .venv directory. It is recommended not to include this directory in version control.
130
+ .pixi
131
+
132
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
133
+ __pypackages__/
134
+
135
+ # Celery stuff
136
+ celerybeat-schedule
137
+ celerybeat.pid
138
+
139
+ # SageMath parsed files
140
+ *.sage.py
141
+
142
+ # Environments
143
+ .env
144
+ .envrc
145
+ .venv
146
+ env/
147
+ venv/
148
+ ENV/
149
+ env.bak/
150
+ venv.bak/
151
+
152
+ # Spyder project settings
153
+ .spyderproject
154
+ .spyproject
155
+
156
+ # Rope project settings
157
+ .ropeproject
158
+
159
+ # mkdocs documentation
160
+ /site
161
+
162
+ # mypy
163
+ .mypy_cache/
164
+ .dmypy.json
165
+ dmypy.json
166
+
167
+ # Pyre type checker
168
+ .pyre/
169
+
170
+ # pytype static type analyzer
171
+ .pytype/
172
+
173
+ # Cython debug symbols
174
+ cython_debug/
175
+
176
+ # PyCharm
177
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
178
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
179
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
180
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
181
+ #.idea/
182
+
183
+ # Abstra
184
+ # Abstra is an AI-powered process automation framework.
185
+ # Ignore directories containing user credentials, local state, and settings.
186
+ # Learn more at https://abstra.io/docs
187
+ .abstra/
188
+
189
+ # Visual Studio Code
190
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
191
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
192
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
193
+ # you could uncomment the following to ignore the entire vscode folder
194
+ # .vscode/
195
+
196
+ # Ruff stuff:
197
+ .ruff_cache/
198
+
199
+ # PyPI configuration file
200
+ .pypirc
201
+
202
+ # Cursor
203
+ # Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
204
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
205
+ # refer to https://docs.cursor.com/context/ignore-files
206
+ .cursorignore
207
+ .cursorindexingignore
208
+
209
+ # Marimo
210
+ marimo/_static/
211
+ marimo/_lsp/
212
+ __marimo__/
213
+
214
+ # Generated by sphinx_fonts extension (downloaded at build time)
215
+ docs/_static/fonts/
216
+ docs/_static/css/fonts.css
217
+
218
+ # Claude Code
219
+ **/CLAUDE.local.md
220
+ **/CLAUDE.*.md
221
+ **/.claude/settings.local.json
222
+
223
+ # Playwright MCP
224
+ .playwright-mcp/
225
+
226
+ # Repo-local pytest mirror (do not track — validator-only)
227
+ out/
228
+
229
+ # Misc
230
+ .vim/
231
+ *.lprof
232
+ pip-wheel-metadata/
233
+ monkeytype.sqlite3
@@ -0,0 +1,106 @@
1
+ Metadata-Version: 2.4
2
+ Name: sphinx-vite-builder
3
+ Version: 0.0.1a16.dev0
4
+ Summary: PEP 517 build backend + Sphinx extension that orchestrates Vite via pnpm
5
+ Project-URL: Repository, https://github.com/git-pull/gp-sphinx
6
+ Author-email: Tony Narlock <tony@git-pull.com>
7
+ License: MIT
8
+ Keywords: backend,build,extension,pep517,pnpm,sphinx,vite
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Framework :: Sphinx
11
+ Classifier: Framework :: Sphinx :: Extension
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
20
+ Classifier: Topic :: Documentation
21
+ Classifier: Topic :: Documentation :: Sphinx
22
+ Classifier: Topic :: Software Development :: Build Tools
23
+ Classifier: Typing :: Typed
24
+ Requires-Python: <4.0,>=3.10
25
+ Requires-Dist: hatchling>=1.0
26
+ Requires-Dist: sphinx>=8.1
27
+ Description-Content-Type: text/markdown
28
+
29
+ # sphinx-vite-builder
30
+
31
+ PEP 517 build backend and Sphinx extension that transparently orchestrates
32
+ [Vite](https://vitejs.dev/) builds via [pnpm](https://pnpm.io/) for
33
+ Sphinx-theme packages whose static assets (CSS / JS) are produced by a
34
+ JavaScript toolchain.
35
+
36
+ ## What it solves
37
+
38
+ A common pattern for modern Sphinx themes is a Python package whose
39
+ `theme/<name>/static/` directory ships built CSS and JS that were
40
+ produced by a JS build tool (Vite, webpack, …). The build artefacts are
41
+ gitignored — they're reproducibly built, not source code. But that
42
+ creates two friction points:
43
+
44
+ 1. **Editable installs and source-tree builds** crash with confusing
45
+ errors when the static dir is empty (e.g. hatchling's
46
+ `Forced include not found`).
47
+ 2. **CI workflows** must duplicate `pnpm install + vite build` setup
48
+ steps in every job that touches the package.
49
+
50
+ `sphinx-vite-builder` owns the Vite invocation end-to-end — exactly the
51
+ way [maturin](https://github.com/PyO3/maturin) owns Cargo for
52
+ Rust+Python packages, or
53
+ [sphinx-theme-builder](https://github.com/pradyunsg/sphinx-theme-builder)
54
+ owns webpack for older Sphinx themes.
55
+
56
+ ## Two heads, one subprocess core
57
+
58
+ ### PEP 517 build backend
59
+
60
+ Drop-in replacement for `hatchling.build`. Runs `pnpm exec vite build`
61
+ before delegating wheel/sdist construction to hatchling.
62
+
63
+ ```toml
64
+ # packages/your-theme/pyproject.toml
65
+ [build-system]
66
+ requires = ["hatchling>=1.0", "sphinx-vite-builder"]
67
+ build-backend = "sphinx_vite_builder.build"
68
+ backend-path = ["../sphinx-vite-builder/src"] # for in-tree workspace consumption
69
+ ```
70
+
71
+ The backend short-circuits when `web/` (the Vite source tree) is absent
72
+ — so `pip install <pkg>.tar.gz` from an unpacked sdist works without
73
+ pnpm or Node, because the sdist already contains pre-baked
74
+ `static/`.
75
+
76
+ ### Sphinx extension
77
+
78
+ Loaded from `conf.py`. Runs Vite as part of the docs lifecycle:
79
+
80
+ - `sphinx-build` → `pnpm exec vite build` once before the docs build
81
+ - `sphinx-autobuild` → `pnpm exec vite build --watch` as a child process
82
+ for the lifetime of the autobuild server, with idempotent re-fire on
83
+ rebuilds and graceful teardown on signal / `atexit`
84
+
85
+ ```python
86
+ # docs/conf.py
87
+ extensions = ["sphinx_vite_builder"]
88
+ sphinx_vite_root = "../packages/your-theme/web" # path to vite project
89
+ sphinx_vite_mode = "auto" # auto | dev | prod | disabled
90
+ ```
91
+
92
+ ## Fast-fail diagnostics
93
+
94
+ When prerequisites are missing the backend / extension raises
95
+ actionable errors rather than producing broken output:
96
+
97
+ - `PnpmMissingError` — `pnpm` not on `PATH`; hint includes
98
+ `corepack enable` and the `pnpm.io` install URL
99
+ - `NodeModulesInstallError` — `pnpm install` exited non-zero; hint
100
+ includes the rerun command
101
+ - `ViteFailedError` — `pnpm exec vite build` exited non-zero; hint
102
+ surfaces the captured stderr
103
+
104
+ ## License
105
+
106
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,78 @@
1
+ # sphinx-vite-builder
2
+
3
+ PEP 517 build backend and Sphinx extension that transparently orchestrates
4
+ [Vite](https://vitejs.dev/) builds via [pnpm](https://pnpm.io/) for
5
+ Sphinx-theme packages whose static assets (CSS / JS) are produced by a
6
+ JavaScript toolchain.
7
+
8
+ ## What it solves
9
+
10
+ A common pattern for modern Sphinx themes is a Python package whose
11
+ `theme/<name>/static/` directory ships built CSS and JS that were
12
+ produced by a JS build tool (Vite, webpack, …). The build artefacts are
13
+ gitignored — they're reproducibly built, not source code. But that
14
+ creates two friction points:
15
+
16
+ 1. **Editable installs and source-tree builds** crash with confusing
17
+ errors when the static dir is empty (e.g. hatchling's
18
+ `Forced include not found`).
19
+ 2. **CI workflows** must duplicate `pnpm install + vite build` setup
20
+ steps in every job that touches the package.
21
+
22
+ `sphinx-vite-builder` owns the Vite invocation end-to-end — exactly the
23
+ way [maturin](https://github.com/PyO3/maturin) owns Cargo for
24
+ Rust+Python packages, or
25
+ [sphinx-theme-builder](https://github.com/pradyunsg/sphinx-theme-builder)
26
+ owns webpack for older Sphinx themes.
27
+
28
+ ## Two heads, one subprocess core
29
+
30
+ ### PEP 517 build backend
31
+
32
+ Drop-in replacement for `hatchling.build`. Runs `pnpm exec vite build`
33
+ before delegating wheel/sdist construction to hatchling.
34
+
35
+ ```toml
36
+ # packages/your-theme/pyproject.toml
37
+ [build-system]
38
+ requires = ["hatchling>=1.0", "sphinx-vite-builder"]
39
+ build-backend = "sphinx_vite_builder.build"
40
+ backend-path = ["../sphinx-vite-builder/src"] # for in-tree workspace consumption
41
+ ```
42
+
43
+ The backend short-circuits when `web/` (the Vite source tree) is absent
44
+ — so `pip install <pkg>.tar.gz` from an unpacked sdist works without
45
+ pnpm or Node, because the sdist already contains pre-baked
46
+ `static/`.
47
+
48
+ ### Sphinx extension
49
+
50
+ Loaded from `conf.py`. Runs Vite as part of the docs lifecycle:
51
+
52
+ - `sphinx-build` → `pnpm exec vite build` once before the docs build
53
+ - `sphinx-autobuild` → `pnpm exec vite build --watch` as a child process
54
+ for the lifetime of the autobuild server, with idempotent re-fire on
55
+ rebuilds and graceful teardown on signal / `atexit`
56
+
57
+ ```python
58
+ # docs/conf.py
59
+ extensions = ["sphinx_vite_builder"]
60
+ sphinx_vite_root = "../packages/your-theme/web" # path to vite project
61
+ sphinx_vite_mode = "auto" # auto | dev | prod | disabled
62
+ ```
63
+
64
+ ## Fast-fail diagnostics
65
+
66
+ When prerequisites are missing the backend / extension raises
67
+ actionable errors rather than producing broken output:
68
+
69
+ - `PnpmMissingError` — `pnpm` not on `PATH`; hint includes
70
+ `corepack enable` and the `pnpm.io` install URL
71
+ - `NodeModulesInstallError` — `pnpm install` exited non-zero; hint
72
+ includes the rerun command
73
+ - `ViteFailedError` — `pnpm exec vite build` exited non-zero; hint
74
+ surfaces the captured stderr
75
+
76
+ ## License
77
+
78
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,49 @@
1
+ [project]
2
+ name = "sphinx-vite-builder"
3
+ version = "0.0.1a16.dev0"
4
+ description = "PEP 517 build backend + Sphinx extension that orchestrates Vite via pnpm"
5
+ requires-python = ">=3.10,<4.0"
6
+ authors = [
7
+ {name = "Tony Narlock", email = "tony@git-pull.com"}
8
+ ]
9
+ license = { text = "MIT" }
10
+ classifiers = [
11
+ "Development Status :: 3 - Alpha",
12
+ "License :: OSI Approved :: MIT License",
13
+ "Framework :: Sphinx",
14
+ "Framework :: Sphinx :: Extension",
15
+ "Intended Audience :: Developers",
16
+ "Programming Language :: Python :: 3",
17
+ "Programming Language :: Python :: 3.10",
18
+ "Programming Language :: Python :: 3.11",
19
+ "Programming Language :: Python :: 3.12",
20
+ "Programming Language :: Python :: 3.13",
21
+ "Programming Language :: Python :: 3.14",
22
+ "Topic :: Documentation",
23
+ "Topic :: Documentation :: Sphinx",
24
+ "Topic :: Software Development :: Build Tools",
25
+ "Typing :: Typed",
26
+ ]
27
+ readme = "README.md"
28
+ keywords = ["sphinx", "extension", "vite", "pnpm", "pep517", "build", "backend"]
29
+ # Both heads (PEP 517 backend + Sphinx extension) share a single subprocess
30
+ # core. Sphinx is required at runtime for the extension head; hatchling is
31
+ # required at build time of consumer packages but not at runtime, so it
32
+ # stays in [build-system].requires of *consumers* rather than here.
33
+ dependencies = [
34
+ "hatchling>=1.0",
35
+ "sphinx>=8.1",
36
+ ]
37
+
38
+ [project.entry-points."sphinx.extensions"]
39
+ "sphinx-vite-builder" = "sphinx_vite_builder"
40
+
41
+ [project.urls]
42
+ Repository = "https://github.com/git-pull/gp-sphinx"
43
+
44
+ [build-system]
45
+ requires = ["hatchling"]
46
+ build-backend = "hatchling.build"
47
+
48
+ [tool.hatch.build.targets.wheel]
49
+ packages = ["src/sphinx_vite_builder"]
@@ -0,0 +1,43 @@
1
+ """sphinx-vite-builder: PEP 517 backend + Sphinx extension.
2
+
3
+ Two orthogonal entry points share one subprocess core:
4
+
5
+ - :mod:`sphinx_vite_builder.build` — the PEP 517 backend module that
6
+ consumer packages reference via
7
+ ``[build-system].build-backend = "sphinx_vite_builder.build"``.
8
+ - :func:`sphinx_vite_builder.setup` — the Sphinx extension entry point
9
+ that ``conf.py`` references via
10
+ ``extensions = ["sphinx_vite_builder"]``.
11
+
12
+ Neither head calls the other; they share the implementation modules
13
+ under :mod:`sphinx_vite_builder._internal`.
14
+ """
15
+
16
+ from __future__ import annotations
17
+
18
+ import typing as t
19
+
20
+ __version__ = "0.0.1a16.dev0"
21
+
22
+ if t.TYPE_CHECKING:
23
+ from sphinx.application import Sphinx
24
+
25
+
26
+ def setup(app: Sphinx) -> dict[str, t.Any]:
27
+ """Register the Sphinx-extension head.
28
+
29
+ Phase 1 ships the PEP 517 backend; the extension head's full
30
+ implementation (vite watch on ``sphinx-autobuild``, one-shot build
31
+ on ``sphinx-build``) lands in a follow-up commit. For now this
32
+ stub registers the extension so consumers can declare it without
33
+ a no-such-module error, and returns the safety metadata.
34
+ """
35
+ del app
36
+ return {
37
+ "parallel_read_safe": True,
38
+ "parallel_write_safe": True,
39
+ "version": __version__,
40
+ }
41
+
42
+
43
+ __all__ = ("__version__", "setup")
@@ -0,0 +1,7 @@
1
+ """Private implementation modules for ``sphinx-vite-builder``.
2
+
3
+ Anything imported from this package is *not* part of the stable public
4
+ surface — both heads (PEP 517 backend in :mod:`sphinx_vite_builder.build`
5
+ and Sphinx extension in :mod:`sphinx_vite_builder`) reach in here, but
6
+ external callers should not.
7
+ """