Skip to main content

sphinx-ask-chatgpt

The initial release version is 0.0.1.

An extension for Sphinx HTML and dirhtml builds, requiring Python 3.11 or later and Sphinx 7.4 or later, below 10.

pip install ./sphinx-ask-chatgpt

Register it in conf.py:

extensions = ["sphinx_ask_chatgpt"]
# Optional settings; both default to True.
ask_chatgpt_enabled = True
ask_chatgpt_adjust_layout = True

The extension inserts the widget only into regular document pages. It does not insert it into generated search/index pages, non-HTML builds, or singlehtml builds. No template override is required. Disabling the extension empties the document manifest and removes old references. Layout adjustment applies only to Alabaster and does not impose that layout on other themes. Reference retrieval is independent of the theme.

Local serving

The serve extra adds fastapi-chatgpt-plan==0.1.0 and Uvicorn. Backend 0.1.0 is fetched from PyPI; the original repository checkout is not required.

pip install './sphinx-ask-chatgpt[serve]'
sphinx-build -W -b html docs docs/_build/html
CHATGPT_PLAN_ENABLED=true sphinx-ask-chatgpt serve --html docs/_build/html

Open http://127.0.0.1:8000/. Set CHATGPT_APP_PORT to change the port and CHATGPT_STATE_DIR to change the registration directory. You can reuse the existing backend registration directory. OAuth tokens, browser sessions, and authentication return targets are held only in memory. Building documentation requires no npm, Node.js, running server, or authentication. Importing the extension does not import FastAPI.

Generated references

At doctree-resolved, the extension extracts headings, paragraphs, lists, tables, code examples, and autodoc signatures and descriptions from the expanded, resolved document tree. This includes nested and partial includes, literalinclude, substitutions, and HTML-only conditional content. Comments, build warnings, and the bodies of other pages referenced by a table of contents are excluded. Code line breaks and indentation are preserved. The extension works with html_copy_source=False and hidden source links.

It generates _ask_chatgpt/documents/<SHA-256 of docname>.json and _ask_chatgpt/manifest.json. The manifest records output URLs supplied by the builder, and the bootstrap passes the docname registered at build time. GET /_chatgpt/document?doc=<docname> retrieves only registered references; arbitrary file paths and external URLs are not accepted. At runtime, only the generated HTML and references are needed. Source files and pickled doctrees are not read.

In this initial version, incremental builds reread all current documents to reliably reflect include and docstring changes. Deleting a document removes its manifest entry and reference. Build-time optimization is future work. The extension does not declare parallel-build safety, and parallel builds are outside the supported scope.

Server and OAuth compatibility

Document routes are composed into the same FastAPI application created by the backend factory, preserving Host, Origin, CSRF, and cookie renewal behavior. /api, /auth, /health, /_chatgpt, and /_ask_chatgpt are reserved. Unknown API routes do not fall back to document files. Document, reference, and asset serving reject path traversal and symlinks resolving outside the selected directories.

Authentication return targets must identify existing same-origin HTML documents. They are bound to the OAuth state, original browser session, generation, and expiration. The adapter delegates to the original login/callback functions and changes the return target only after successful validation and cookie rotation. This internal compatibility dependency is confined to auth_return.py, and the backend dependency is pinned to 0.1.0. Future backend upgrades require compatibility tests and an updated dependency constraint.

This is a local, single-account, single-process implementation. The widget can appear on public sites, but HTTPS deployment, per-visitor session/token isolation, and cloud authentication are outside the current scope. Real-account verification is recorded in the root implementation-report.md.

Distribution and API references

The canonical shared JavaScript lives in ../ask-ai/src/ and is bundled using ../tools/sync-widget-assets.py. Its version and SHA-256 hashes are recorded in widget-version.json and checked for consistency in CI. A wheel can be built from the sdist alone, so installing the package does not require the sibling JavaScript directory.

Metadata

Release files for sphinx-ask-chatgpt 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sphinx-ask-chatgpt 0.0.1
File Size Uploaded Provenance Actions
sphinx_ask_chatgpt-0.0.1.tar.gz 27.8 kB With provenance Details for sphinx_ask_chatgpt-0.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sphinx-ask-chatgpt 0.0.1
File Interpreter ABI Platform Actions
sphinx_ask_chatgpt-0.0.1-py3-none-any.whl Python 3 none any Details for sphinx_ask_chatgpt-0.0.1-py3-none-any.whl

Total release size: 52.3 kB

Release files / sphinx_ask_chatgpt-0.0.1.tar.gz

Download URL sphinx_ask_chatgpt-0.0.1.tar.gz
Size 27.8 kB
Tags Source
SHA-256 checksum
How to use checksums
31176ccf5ed20d2ab59b82b0c5f5fd8cb122c561c2c703311dd8eed2f7b7854c
BLAKE2b-256 checksum
How to use checksums
33d127a1dcaba3bfb38a96af381da3220adb504b84efc1c74c3580e77b4d75f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 4, 2026.

Transparency log

Release files / sphinx_ask_chatgpt-0.0.1-py3-none-any.whl

Download URL sphinx_ask_chatgpt-0.0.1-py3-none-any.whl
Size 24.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2250c8f52f882b9368798ac25a9c73f4b7bbc10c8f98302a71d099d2d25dea3c
BLAKE2b-256 checksum
How to use checksums
5b849403e8cabe2fd45fe502d91801d978187fc5e44b8aeea9ac19aa29c5b73c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 4, 2026.

Transparency log

Security for sphinx-ask-chatgpt 0.0.1

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for sphinx_ask_chatgpt-0.0.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 4, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page