Skip to main content

A Sphinx theme for Qiskit and Qiskit Ecosystem projects

Project description

qiskit-sphinx-theme

The Sphinx theme for Qiskit ecosystem documentation.

Warning: new theme migration

In qiskit-sphinx-theme 1.14, we replaced the old qiskit_sphinx_theme based on Pytorch with the new qiskit-ecosystem theme based on Furo. The old theme was removed in qiskit-sphinx-theme 2.0.

See Migrate from old Pytorch theme to new theme for migration instructions.

Overview

This repository hosts three things:

  • qiskit-ecosystem theme (located in the src/ folder)
  • example docs (located in the example_docs/ folder)
  • Qiskit Docs Guide (located in the docs_guide/ folder)

The qiskit-ecosystem theme is used by projects in the Qiskit ecosystem.

The example docs are a minimal Sphinx project that is used for testing the Qiskit Sphinx Theme. Every pull request will trigger a GitHub workflow that builds the example docs to make sure the changes do not introduce unintended changes.

The Qiskit Docs Guide hosts instructions, guidelines and recommendations of good documentation practices. Its intent is to help Qiskit maintainers improve the documentation of their projects. The guide is hosted online here: https://qisk.it/docs-guide.

Installation

This package is available on PyPI using:

pip install qiskit-sphinx-theme

Then, set up the theme by updating conf.py:

  1. Set html_theme = "qiskit-ecosystem"
  2. Add "qiskit_sphinx_theme" to extensions

You also likely want to set html_title in conf.py. This results in the left sidebar having a more useful and concise name, along with the page title in the browser. Most projects will want to use this in their conf.py:

# Sphinx expects you to set these already.
project = "My Project"
release = "4.12"

# This sets the title to e.g. `My Project 4.12`.
html_title = f"{project} {release}"

Enable translations

Refer to Sphinx's internationalization guide for how to build your documentation with different languages.

Once you have the translated documentation, you will need to start additionally deploying your docs to <project-prefix>/locale/<locale-code>/, e.g. https://qiskit-community.github.io/qiskit-finance/locale/de_DE/index.html.

Finally, update your conf.py:

  • Ensure that qiskit_sphinx_theme is in the extensions setting.
  • Set the option translations_list to a list of pairs of the locale code and the language name, e.g. [..., ("de_DE", "German")].
  • Set the option docs_url_prefix to your project's URL prefix, like qiskit-finance.

For example:

extensions = [
   ...,
   "qiskit_sphinx_theme",
]

translations_list = [
    ('en', 'English'),
    ('bn_BN', 'Bengali'),
    ('fr_FR', 'French'),
    ('de_DE', 'German'),
]

docs_url_prefix = "qiskit-finance"

Enable Previous Releases

This feature allows you to link to previous versions of the docs in the left sidebar.

First, start additionally deploying your docs to <project-prefix>/stable/<version>/, e.g. https://qiskit-community.github.io/qiskit-experiments/stable/0.5/index.html. See https://github.com/qiskit-community/qiskit-experiments/blob/7a0924c24549ab4f38819a86c0ac49214d819ba2/.github/workflows/docs_stable.yml#L25-L38 for an example.

Then, update your conf.py:

  • Ensure that qiskit_sphinx_theme is in the extensions setting.
  • Add to the option html_context an entry for version_list with a list of the prior versions, e.g. ["0.4", "0.5"].
    • Each of these versions must be deployed with the above stable/<version> URL scheme.
    • You can manually set this, or some projects write a Sphinx extension to dynamically compute the value.
    • You should only put prior versions in this list, not the current release.
  • Set the option docs_url_prefix to your project's URL prefix, like qiskit-experiments.

For example:

extensions = [
   ...,
   "qiskit_sphinx_theme",
]

html_context = {
   "version_list": ["0.4", "0.5"],
}

docs_url_prefix = "qiskit-experiments"

Use custom RST directives

The qiskit_sphinx_theme extension defines the below custom directives for you to use in RST, if you'd like. See example_docs/docs/sphinx_guide/custom_directives.rst for examples of how to use them.

  • qiskit-card
  • qiskit-call-to-action-item and qiskit-call-to-action-grid

Add a custom logo

You can add a custom logo by adding a logo file (SVG or PNG) as a sibling to your conf.py, e.g. docs/logo.svg. Then, set html_logo in conf.py to the name of the file, e.g. html_logo = "logo.png".

When using a custom logo, you may want to disable the project's name in the sidebar by setting sidebar_hide_name in html_theme_options in conf.py:

html_theme_options = {
    "sidebar_hide_name": True,
}

Qiskit ecosystem members

If your project is a member of the Qiskit ecosystem, we encourage you to set the following configuration so that the left sidebar mentions your project being in the ecosystem.

Update conf.py:

html_theme_options = {
    "sidebar_qiskit_ecosystem_member": True,
}

Non-ecosystem members should not set this option.

Tip: suggested site structure

To keep UX/UI similar across different Qiskit ecosystem packages, consider using the following structure for your sidebar, which can be set in the toctree of your index.rst:

.. toctree::
  :hidden:

   Documentation Home <index>
   Getting Started <getting_started>
   Tutorials <tutorials/index>
   How-to Guides <how_to/index>
   API Reference <apidocs/index>
   Explanations <explanations/index>
   Release Notes <release_notes>
   GitHub <https://github.com/your-repo>

Each item in the toctree corresponds to a single .rst file, and can use internal links or external. External links will have a "new tab" icon rendered next to them.

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

qiskit_sphinx_theme-2.1.0.tar.gz (2.4 MB view details)

Uploaded Source

Built Distribution

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

qiskit_sphinx_theme-2.1.0-py3-none-any.whl (188.2 kB view details)

Uploaded Python 3

File details

Details for the file qiskit_sphinx_theme-2.1.0.tar.gz.

File metadata

  • Download URL: qiskit_sphinx_theme-2.1.0.tar.gz
  • Upload date:
  • Size: 2.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for qiskit_sphinx_theme-2.1.0.tar.gz
Algorithm Hash digest
SHA256 5abd24d33dfe6488d3fc8e9e48905592b36366ad304bb3ce09c3f95b7320dfb0
MD5 347d4066eb4ca65dd866cad2b3289fb4
BLAKE2b-256 36607f7a0b5eefb1d4d3169773d2736550ac6a1d19887733f807e37b61a9e80b

See more details on using hashes here.

Provenance

The following attestation bundles were made for qiskit_sphinx_theme-2.1.0.tar.gz:

Publisher: release.yml on Qiskit/qiskit_sphinx_theme

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qiskit_sphinx_theme-2.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for qiskit_sphinx_theme-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 19fb393a5b1200e2c212a0e4f0317abbfb2a0272af66b9f6a2137acd09923657
MD5 fc0a055d28f893fdbe0e20418b36bb62
BLAKE2b-256 8bbf3d51358b875927b2cb8108394424d4affb6ee50fc9b3a461ff211d2284a9

See more details on using hashes here.

Provenance

The following attestation bundles were made for qiskit_sphinx_theme-2.1.0-py3-none-any.whl:

Publisher: release.yml on Qiskit/qiskit_sphinx_theme

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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