Sphinx SpladeX
SpladeX adds static, client-side hybrid search to Sphinx HTML documentation. At
build time it extracts pages and documented objects, creates SPLADE sparse
vectors plus a BM25 index, and writes assets into _static. At search time the
browser loads only those assets: it does not run or download a model.
Install
pip install sphinx-spladex
Development
Install the test and release tools, then run the release check:
pip install -e ".[dev]"
scripts/release-check.sh
Enable
Add the extension to conf.py:
extensions = ["spladex"]
The default model is opensearch-project/opensearch-neural-sparse-encoding-doc-v3-distill
(67M parameters, Apache-2.0). Any SPLADE-style document encoder with an MLM head works if it
ships static query weights, either as static_query_weights.pt (a one-dimensional
query_weights tensor matching the tokenizer vocabulary) or as an idf.json (token to weight).
On documentation projects that none of the encoders was trained on (Flutter and React), the
hybrid search improves nDCG@10 over BM25 from 0.509 to 0.547 and from 0.499 to 0.556 with
the default encoder. naver/splade-v3-doc is stronger (0.560 on Flutter) but is licensed
CC BY-NC-SA 4.0, so it is not suitable for commercial sites. The models trained in this project
(Arvind0101/static-query-splade-code-docs, Akshat131/static-splade-trained-pruned,
Akshat131/splade-multi-static-pruned-v2) are fine-tuned from SPLADE-v3-doc, inherit its
licence, and do not beat BM25 on those unseen projects.
spladex_model_name = "opensearch-project/opensearch-neural-sparse-encoding-doc-v3-distill"
spladex_device = "cpu"
spladex_max_length = 256
spladex_top_k_terms = 96
spladex_min_weight = 0.0
spladex_semantic_weight = 0.6
spladex_bm25_weight = 0.4
spladex_rrf_k = 60
# Index and ranking (defaults shown)
spladex_index_format = "compact" # or "legacy" (pretty-printed v0.1 format)
spladex_bm25_tokenizer = "identifier" # also index snake_case / camelCase / dotted parts
spladex_bm25_prefix_match = False # v0.1 matched words by a crude stem prefix
spladex_title_boost = "off" # "always" (v0.1), "identifier" (code-like queries only), "off"
spladex_dedupe = "exact" # "aggressive" (v0.1) also hides methods sharing a short name
# UI Theme & Customization (Optional)
spladex_results_per_page = 10
spladex_highlight_color = "#fff3a0"
spladex_accent_color = "#0066cc"
spladex_badge_style = "pill" # "pill", "subtle", or "none"
spladex_enable_keyboard_shortcut = True # Ctrl+K / /
spladex_enable_live_search = True
spladex_show_engine_toggle = False # Hybrid / SpladeX-only / BM25-only switch (demos)
spladex_show_matched_terms = False # "matched: ..." line under each result
After sphinx-build -b html docs docs/_build/html, the generated site includes
_static/model_semantic_index.json and _static/model_static_query_assets.json.
SpladeX reads the tokenizer files and the static query weights (static_query_weights.pt
or idf.json) during the documentation build. It bundles their tokenization rules and
aligned weights into the local query-assets file; search never requests those source files
or a model from Hugging Face.
SpladeX replaces the standard Sphinx results with semantic hybrid results while retaining the usual Sphinx search-page presentation. It does not show relevance scores; the engine switch and matched terms are opt-in (see above).
Metadata
Release files for sphinx-spladex 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sphinx_spladex-0.2.0.tar.gz | 21.2 kB | Without provenance | Details for sphinx_spladex-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sphinx_spladex-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for sphinx_spladex-0.2.0-py3-none-any.whl |
Total release size: 45.5 kB
Release files / sphinx_spladex-0.2.0.tar.gz
| Download URL | sphinx_spladex-0.2.0.tar.gz |
|---|---|
| Size | 21.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7f97d4012c04775eda7255cabea582b8902814039c9942d20c5e6275d33c7125
|
|
BLAKE2b-256 checksum How to use checksums |
8efb5ed2d1f8a3fc83d05b40dacf1c75bc7d1f4167957ca17a5ed0a15e0af246
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / sphinx_spladex-0.2.0-py3-none-any.whl
| Download URL | sphinx_spladex-0.2.0-py3-none-any.whl |
|---|---|
| Size | 24.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7c0f40dd8ceaec55400d0d398366a8477e2bc9ef0055a7d2a0e9b6961c21596b
|
|
BLAKE2b-256 checksum How to use checksums |
2bf6df4e5ed8396129e51e6dd5db613e340b47ac72885e5bce1e2611cf04384c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Security for sphinx-spladex 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.