Skip to main content

sphinx-book-theme with optional TuringQ company header and footer chrome for Sphinx docs

Project description

turingq-sphinx-theme

Sphinx HTML theme extending sphinx-book-theme with optional TuringQ company header/footer (static chrome, CSS/JS bundled in the wheel).

Use this package when algorithm or product teams build standalone Sphinx docs while keeping the same top bar and footer as the main DeepQuantum site.

Install

pip install turingq-sphinx-theme

Verify the theme (developers / before publish)

From a clone of this repo, install in editable mode and run the smoke script (uses sphinx-build or python -m sphinx.cmd.build):

cd turingq-sphinx-theme
python -m pip install -e .
./examples/smoke/verify.sh    # or: PYTHON=/path/to/venv/bin/python ./examples/smoke/verify.sh

See examples/smoke/README.md for manual checks and turingq_company_chrome: False experiments.

conf.py (minimal)

Sphinx discovers the theme via the sphinx.html_themes entry point and runs this package’s setup() (same pattern as sphinx-book-theme), which registers the theme path and injects custom.cssiframe-fullscreen-fallback.js (fullscreen tooltips / iframe behavior), then site-chrome.css / site-chrome.js when turingq_company_chrome is enabled. Do not duplicate those names under html_css_files / html_js_files.

Bundled custom.css does not include DeepQuantum-main-site-only CSS that hides PDF / extra source formats in the download dropdown when .ipynb is present—you get the theme default download list (.rst, .pdf, etc.) without extra hides.

html_theme = "turingq_sphinx_theme"

# Optional but recommended (matches upstream DeepQuantum docs): keep body/default mode aligned with forced light CSS.
html_context = {"default_mode": "light"}

html_theme_options = {
    # Default is True — company header/footer + chrome assets.
    "turingq_company_chrome": True,
    # Optional — override logo link & top navigation (defaults in turingq_sphinx_theme/defaults.py):
    # "turingq_logo_href": "https://example.org/",
    # "turingq_nav": [{"text": "Home", "url": "/", "external": False}],
    # Forward any sphinx-book / pydata options below, for example:
    # "repository_url": "https://github.com/you/your-repo",
}

You do not need to duplicate the theme module under extensions (unless your team explicitly prefers it; Sphinx will otherwise load setup() when the HTML theme resolves).

Disable company chrome (plain sphinx-book-theme look, minus our layout overrides):

html_theme_options = {"turingq_company_chrome": False}

Theme configuration switch

The option is declared in theme.conf as turingq_company_chrome and can be overridden from html_theme_options in conf.py.

Build and publish to PyPI(软件组标准流程)

算法侧要求:在本地开发与测试完成之后,使用社区通行的 Python 打包工具链生成 wheel/sdist,再上传到 PyPI——不要用手写非标脚本或未版本化的零散拷贝。

1. 前置检查

步骤 说明
自测 在本仓库根目录执行 ./examples/smoke/verify.sh(需已 pip install -e .,见上文「Verify the theme」),确认主题可正常构建 HTML。
版本号 新发布时请同步调高 pyproject.tomlproject.versionturingq_sphinx_theme/__init__.__version__,二者须一致;否则轮子与 Sphinx 报告的版本会不一致。

2. 安装打包工具

pip install build twine
  • build:按 pyproject.toml / PEP 517,在隔离环境中调用 setuptools 后端生成 dist/ 下的 .whl源码发行包
  • twine:将 dist/ 中的制品上传到 PyPI(或配置的索引)。

3. 打包

在本目录 turingq-sphinx-theme/(包含 pyproject.toml 的一级目录)执行:

cd turingq-sphinx-theme
python -m build

成功后 dist/ 中应有当前版本的 wheel*.whl)与 sdist*.tar.gz)。

4. 发布到 PyPI

twine upload dist/*

等价写法(同一版本只有两个主文件时可显式列出):

twine upload dist/turingq_sphinx_theme-*.whl dist/turingq_sphinx_theme-*.tar.gz

凭证(需在组织或个人账号就绪后再执行):

  • 推荐 PyPI API tokenpypi-...
    可先配置 ~/.pypirc,或使用:TWINE_USERNAME=__token__ TWINE_PASSWORD=pypi-xxxx twine upload dist/*
  • 或组织使用的 Trusted Publishing(如 CI 与 PyPI OIDC),按内部文档配置,不一定要本机 twine upload

请勿将 token 写入仓库。首次也可先推到 TestPyPI 试安装:

twine upload --repository testpypi dist/*

Detailed technical documentation (Chinese)

Integration of the upstream DeepQuantum docs (project-local templates + _static) and architecture of this package (Sphinx entry points, inheritance, migrations): see TECHNICAL.md.

License

Apache-2.0 (same as parts of upstream assets originating from this repository).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

turingq_sphinx_theme-0.1.0.tar.gz (145.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

turingq_sphinx_theme-0.1.0-py3-none-any.whl (146.4 kB view details)

Uploaded Python 3

File details

Details for the file turingq_sphinx_theme-0.1.0.tar.gz.

File metadata

  • Download URL: turingq_sphinx_theme-0.1.0.tar.gz
  • Upload date:
  • Size: 145.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for turingq_sphinx_theme-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e03dc51234e05d9f591c86325f6a925727262acabaaa9600bb8197336a6ff266
MD5 eb7b443d04c6b9264f29fb0a02e9740e
BLAKE2b-256 144afaa0f79af1dd12e1c6478f05ecdbc73c3530387c4671de2132697ec8dad8

See more details on using hashes here.

File details

Details for the file turingq_sphinx_theme-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for turingq_sphinx_theme-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c13777c6bdcd7fe1a5d063bffb5ac33ac57443f88b4e29a299def24166ce7dce
MD5 e73616e8285fe8a254a35471f4a80752
BLAKE2b-256 24fd2369cd9843a7ad85becf6336ceaa6e26faaeffba9d47e24c5f8d1de1efe8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page