pax_global_header 0000666 0000000 0000000 00000000064 15147620124 0014514 g ustar 00root root 0000000 0000000 52 comment=ae90e2c6496ef95d7487e981b8496d024f322939 pallets-pallets-sphinx-themes-17201d8/ 0000775 0000000 0000000 00000000000 15147620124 0017664 5 ustar 00root root 0000000 0000000 pallets-pallets-sphinx-themes-17201d8/.editorconfig 0000664 0000000 0000000 00000000351 15147620124 0022340 0 ustar 00root root 0000000 0000000 root = true [*] indent_style = space indent_size = 4 insert_final_newline = true trim_trailing_whitespace = true end_of_line = lf charset = utf-8 max_line_length = 88 [*.{css,html,js,json,jsx,scss,ts,tsx,yaml,yml}] indent_size = 2 pallets-pallets-sphinx-themes-17201d8/.github/ 0000775 0000000 0000000 00000000000 15147620124 0021224 5 ustar 00root root 0000000 0000000 pallets-pallets-sphinx-themes-17201d8/.github/workflows/ 0000775 0000000 0000000 00000000000 15147620124 0023261 5 ustar 00root root 0000000 0000000 pallets-pallets-sphinx-themes-17201d8/.github/workflows/lock.yaml 0000664 0000000 0000000 00000001252 15147620124 0025075 0 ustar 00root root 0000000 0000000 name: Lock inactive closed issues # Lock closed issues that have not received any further activity for two weeks. # This does not close open issues, only humans may do that. It is easier to # respond to new issues with fresh examples rather than continuing discussions # on old issues. on: schedule: - cron: '0 0 * * *' permissions: issues: write pull-requests: write discussions: write concurrency: group: lock jobs: lock: runs-on: ubuntu-latest steps: - uses: dessant/lock-threads@7266a7ce5c1df01b1c6db85bf8cd86c737dadbe7 # v6.0.0 with: issue-inactive-days: 14 pr-inactive-days: 14 discussion-inactive-days: 14 pallets-pallets-sphinx-themes-17201d8/.github/workflows/pre-commit.yaml 0000664 0000000 0000000 00000001753 15147620124 0026227 0 ustar 00root root 0000000 0000000 name: pre-commit on: pull_request: push: branches: [main, stable] jobs: main: runs-on: ubuntu-latest steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7.3.0 with: enable-cache: true prune-cache: false - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 id: setup-python with: python-version-file: pyproject.toml - uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3 with: path: ~/.cache/pre-commit key: pre-commit|${{ hashFiles('pyproject.toml', '.pre-commit-config.yaml') }} - run: uv run --locked --no-default-groups --group pre-commit pre-commit run --show-diff-on-failure --color=always --all-files - uses: pre-commit-ci/lite-action@5d6cc0eb514c891a40562a58a8e71576c5c7fb43 # v1.1.0 if: ${{ !cancelled() }} pallets-pallets-sphinx-themes-17201d8/.github/workflows/publish.yaml 0000664 0000000 0000000 00000003652 15147620124 0025621 0 ustar 00root root 0000000 0000000 name: Publish on: push: tags: ['*'] jobs: build: runs-on: ubuntu-latest outputs: artifact-id: ${{ steps.upload-artifact.outputs.artifact-id }} steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7.3.0 with: enable-cache: true prune-cache: false - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 with: python-version-file: pyproject.toml - run: echo "SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)" >> $GITHUB_ENV - run: uv build - uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 id: upload-artifact with: name: dist path: dist/ if-no-files-found: error create-release: needs: [build] runs-on: ubuntu-latest permissions: contents: write steps: - uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 with: artifact-ids: ${{ needs.build.outputs.artifact-id }} path: dist/ - name: create release run: gh release create --draft --repo ${{ github.repository }} ${{ github.ref_name }} dist/* env: GH_TOKEN: ${{ github.token }} publish-pypi: needs: [build] environment: name: publish url: https://pypi.org/project/Pallets-Sphinx-Themes/${{ github.ref_name }} runs-on: ubuntu-latest permissions: id-token: write steps: - uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 with: artifact-ids: ${{ needs.build.outputs.artifact-id }} path: dist/ - uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0 with: packages-dir: "dist/" pallets-pallets-sphinx-themes-17201d8/.gitignore 0000664 0000000 0000000 00000000052 15147620124 0021651 0 ustar 00root root 0000000 0000000 .idea/ .vscode/ __pycache__/ docs/_build/ pallets-pallets-sphinx-themes-17201d8/.pre-commit-config.yaml 0000664 0000000 0000000 00000001431 15147620124 0024144 0 ustar 00root root 0000000 0000000 repos: - repo: https://github.com/codespell-project/codespell rev: 63c8f8312b7559622c0d82815639671ae42132ac # frozen: v2.4.1 hooks: - id: codespell - repo: https://github.com/astral-sh/ruff-pre-commit rev: fa93bc3224c614a0e9786d3e2d3d48edcca246eb # frozen: v0.15.1 hooks: - id: ruff-check - id: ruff-format - repo: https://github.com/astral-sh/uv-pre-commit rev: 6e1b55a6dbea001ba7b914eae67df3c4bbd3ff6e # frozen: 0.10.4 hooks: - id: uv-lock - repo: https://github.com/pre-commit/pre-commit-hooks rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # frozen: v6.0.0 hooks: - id: check-merge-conflict - id: debug-statements - id: fix-byte-order-marker - id: trailing-whitespace - id: end-of-file-fixer pallets-pallets-sphinx-themes-17201d8/.readthedocs.yaml 0000664 0000000 0000000 00000000362 15147620124 0023114 0 ustar 00root root 0000000 0000000 version: 2 build: os: ubuntu-24.04 tools: python: '3.13' commands: - asdf plugin add uv - asdf install uv latest - asdf global uv latest - uv run --group docs sphinx-build -W -b dirhtml docs $READTHEDOCS_OUTPUT/html pallets-pallets-sphinx-themes-17201d8/CHANGES.md 0000664 0000000 0000000 00000016003 15147620124 0021256 0 ustar 00root root 0000000 0000000 ## Version 2.5.0 Released 2026-02-25 - Use Atkinson Hyperlegible font. - Click theme does not use monospace font for body. - Use local font files instead of Google Fonts. ## Version 2.4.0 Released 2026-02-25 - Fix compatibility with Sphinx >= 9.0. :issue:`128` - Require Sphinx >= 7.3. :issue:`128` ## Version 2.3.0 Released 2024-10-24 - When getting the canonical URL on Read the Docs, replace the path with `/en/stable/` instead of `/page/`. This can be configured with `rtd_canonical_path`. {pr}`122` - The version banner can be disabled by setting `version_banner = False`. On Read the Docs, it is disabled when building the `stable` version or PRs. {pr}`123` ## Version 2.2.0 Released 2024-10-15 - Get canonical URL from environment variable when building on Read the Docs. {pr}`117` - New version warning banner. Use JavaScript to query PyPI when viewing a page, rather than baking the warning into the build. New builds of old versions are no longer required for the banner to be correct. {pr}`117` - Generate 404 page using the sphinx-notfound-page extension. This fixes the URLs when the page is hosted so that it loads the CSS. {issue}`34` - Remove handling for `singlehtml_sidebars` config which predated Sphinx's support. {pr}`119` - Remove "babel" and "platter" theme variants which were undocumented and did not appear to be used by the relevant projects. {pr}`120` ## Version 2.1.3 Released 2024-04-29 - Allow Sphinx's parallel build feature. {issue}`88` ## Version 2.1.2 Released 2024-04-19 - Use modern packaging metadata with `pyproject.toml` instead of `setup.cfg`. - Use `flit_core` instead of `setuptools` as build backend. - Compatibility with changes in Sphinx 7.3. {pr}`100` ## Version 2.1.1 Released 2023-06-08 - Remove leftover Python 2 compatibility code. {pr}`69` - Dotted underlines on links are smaller. {issue}`70` ## Version 2.1.0 Released 2023-04-25 - Drop support for Python 3.6 and 3.7. - Require Sphinx >= 3. - Remove previously deprecated code. - Fix table of contents overflow issue. ## Version 2.0.3 Released 2022-12-24 - Fix compatibility with `packaging>=22`. ## Version 2.0.2 Released 2021-11-10 - Detect if Sphinx dirhtml builder is generating canonical URLs with ".html" and replace with the correct dir URL. {issue}`47` - `canonical_url` config is deprecated. Use Sphinx's built-in `html_baseurl` config instead. {pr}`53` - Address deprecations in Jinja 2.0. {pr}`54` ## Version 2.0.1 Released 2021-05-20 - Remove workaround for search URLs when using the `dirhtml` builder. The issue has been fixed in Sphinx and the workaround was causing the issue again. {issue}`39` - Remove `html_context["readthedocs_docsearch"]` for controlling whether Read the Docs' search is used. {issue}`40` - Add an `ethicalads.html` sidebar to have Read the Docs always show ads in the sidebar instead of other possible locations. The sidebar is enabled by default at the end of the list. {issue}`41` ## Version 2.0.0 Released 2021-05-11 - Drop Python < 3.6. - Update for Jinja 2.0. - Update for Click 8.0. ## Version 1.2.3 Released 2020-01-02 - Use built-in {mod}`importlib.metadata` on Python 3.8. {pr}`27` ## Version 1.2.2 Released 2019-07-04 - Make the version warning sticky so that it appears when linking to the middle of a document. {issue}`5` - Remove CSS for old ads. ## Version 1.2.1 Released 2019-07-29 - Sort versions taken from Read the Docs so that 2.10.x is considered newer than 2.9.x. {issue}`24` ## Version 1.2.0 Released 2019-07-26 - Use HTTPS for font URLs in CSS. {pr}`22` - Don't require `sphinx.ext.autodoc` to be enabled. - Implement the Jinja directives `jinja:filters::`, `jinja:tests::`, and `jinja:nodes::`. - Generate a table of contents for Jinja filters and tests. - Update the `babel` and `platter` themes. ## Version 1.1.4 Released 2019-01-28 - Store a page's canonical URL in `html_context["page_canonical_url"]` rather than overwriting `canonical_url`, for compatibility with Read the Docs. {pr}`21` ## Version 1.1.3 Released 2019-01-28 - Move the Read the Docs search flag to the `footer` block to ensure it executes after Read the Docs injects its data. {pr}`20` ## Version 1.1.2 Released 2018-09-24 - Strip ".x" placeholder when parsing versions for sidebar. {issue}`7`, {pr}`17` ## Version 1.1.1 Released 2018-09-16 - Add configurable ".x" placheolder to versions, producing strings like "1.2.x". {issue}`6`, {pr}`12` - Add dependency on "packaging" to support older Sphinx versions. {issue}`9`, {pr}`11` - Backport `shlex.quote` for Python 2. {issue}`13`, {pr}`14` ## Version 1.1.0 Released 2018-08-28 - Modernize `click` theme. The `.. click:example::` and `.. click:run::` directives used by Click are available and ported to Python 3. - Modernize `werkzeug` theme. {pr}`4` - Modernize `jinja` theme. Local extensions used by Jinja are not available yet. - Remove theme entry points to make late configuration consistent. The themes are available when `"pallets_sphinx_themes"` is added to `extensions`. - Only run event callbacks added by theme when the theme is actually in use. This allows the package to be installed without interfering with other themes. - Support `html_context["versions"]` in the format injected by Read the Docs. - Set `html_context["readthedocs_docsearch"]` to opt in to replacing Sphinx's built-in search with Read the Docs' new implementation. - Make version handling more robust for various configurations. - Autodoc skips docstrings that contain the line `:internal:`. - Autodoc removes lines that start with `:copyright:` or `:license:` from module docstrings. - Add `singlehtml_sidebars` config for Sphinx < 1.8. - Add `hide-header` CSS class to hide the page header with `.. rst-class:: hide-header`. The header is still usable by assistive technology. This is useful for replacing the header with a large logo image. - Disable the sidebar logo on the index page with `html_theme_options["index_sidebar_logo"] = False`. ## Version 1.0.1 Released 2018-04-29 - Work around an issues with search when using the `dirhtml` builder. {pr}`3` ## Version 1.0.0 Released 2018-04-18 - Major rewrite of CSS and HTML templates to clean up and reduce complexity. Widen columns, improve responsive breakpoints. Currently, all themes are available, but only `pocoo` and `flask` themes are modernized. - Parse `html_context["versions"]`. These will be rendered in the `versions.html` sidebar. When viewing an old version, or the development version, a warning is displayed at the top of each page. - Add a `ProjectLink` named tuple. A list of these in `html_context["project_links"]` will be rendered in the `project.html` sidebar. - Add a `get_version` function to ensure a project is installed and get its version information. - Use `html_context["canonical_url"]` as a base URL to build a canonical URL link on each page. - Add Sphinx entry points for themes. - Rename from "pocoo-sphinx-themes". See commit [f675bfc] for the old themes from the docbuilder. [f675bfc]: https://github.com/pallets/pallets-sphinx-themes/tree/f675bfc pallets-pallets-sphinx-themes-17201d8/LICENSE.txt 0000664 0000000 0000000 00000002703 15147620124 0021511 0 ustar 00root root 0000000 0000000 Copyright 2007 Pallets Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. pallets-pallets-sphinx-themes-17201d8/README.md 0000664 0000000 0000000 00000000570 15147620124 0021145 0 ustar 00root root 0000000 0000000 # Pallets Sphinx Themes Themes for the Pallets projects. If you're writing an extension, use the appropriate theme to make your documentation look consistent. Available themes: - flask - jinja - werkzeug - click Enable the extension and choose the theme in `docs/conf.py`: ```python extensions = [ "pallets_sphinx_themes", ... ] html_theme = "flask" ``` pallets-pallets-sphinx-themes-17201d8/docs/ 0000775 0000000 0000000 00000000000 15147620124 0020614 5 ustar 00root root 0000000 0000000 pallets-pallets-sphinx-themes-17201d8/docs/changes.md 0000664 0000000 0000000 00000000052 15147620124 0022543 0 ustar 00root root 0000000 0000000 # Changes ```{include} ../CHANGES.md ``` pallets-pallets-sphinx-themes-17201d8/docs/conf.py 0000664 0000000 0000000 00000002244 15147620124 0022115 0 ustar 00root root 0000000 0000000 import importlib.metadata # Project -------------------------------------------------------------- project = "Pallets-Sphinx-Themes" version = release = importlib.metadata.version("pallets-sphinx-themes").partition( ".dev" )[0] # General -------------------------------------------------------------- default_role = "code" extensions = [ "sphinx.ext.autodoc", "sphinx.ext.extlinks", "sphinx.ext.intersphinx", "sphinxcontrib.log_cabinet", "myst_parser", "pallets_sphinx_themes", ] autodoc_member_order = "bysource" autodoc_typehints = "description" autodoc_preserve_defaults = True extlinks = { "issue": ("https://github.com/pallets/pallets-sphinx-themes/issues/%s", "#%s"), "pr": ("https://github.com/pallets/pallets-sphinx-themes/pull/%s", "#%s"), } intersphinx_mapping = { "python": ("https://docs.python.org/3/", None), "sphinx": ("https://sphinx-doc.org", None), } myst_enable_extensions = [ "fieldlist", ] myst_heading_anchors = 2 # HTML ----------------------------------------------------------------- html_theme = "flask" html_copy_source = False html_show_copyright = False html_use_index = False html_domain_indices = False pallets-pallets-sphinx-themes-17201d8/docs/index.md 0000664 0000000 0000000 00000000104 15147620124 0022240 0 ustar 00root root 0000000 0000000 # Pallets Sphinx Themes ```{toctree} :hidden: changes license ``` pallets-pallets-sphinx-themes-17201d8/docs/license.md 0000664 0000000 0000000 00000000106 15147620124 0022555 0 ustar 00root root 0000000 0000000 # MIT License ```{literalinclude} ../LICENSE.txt :language: text ``` pallets-pallets-sphinx-themes-17201d8/pyproject.toml 0000664 0000000 0000000 00000010543 15147620124 0022603 0 ustar 00root root 0000000 0000000 [project] name = "Pallets-Sphinx-Themes" version = "2.5.0" description = "Sphinx themes for Pallets and related projects." readme = "README.md" license = "BSD-3-Clause" license-files = ["LICENSE.txt"] maintainers = [{ name = "Pallets", email = "contact@palletsprojects.com" }] classifiers = [ "Development Status :: 5 - Production/Stable", "Framework :: Sphinx", "Framework :: Sphinx :: Theme", "Intended Audience :: Developers", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Documentation", "Topic :: Documentation :: Sphinx", "Topic :: Software Development :: Documentation", ] requires-python = ">=3.10" dependencies = [ "packaging", "sphinx>=7.3", "sphinx-notfound-page", ] [project.urls] Donate = "https://palletsprojects.com/donate" Source = "https://github.com/pallets/pallets-sphinx-themes/" Chat = "https://discord.gg/pallets" [project.entry-points."pygments.styles"] pocoo = "pallets_sphinx_themes.themes.pocoo:PocooStyle" jinja = "pallets_sphinx_themes.themes.jinja:JinjaStyle" [dependency-groups] dev = [ "click>=8.3.1", "ruff", "tox", "tox-uv", ] docs = [ "myst-parser", "sphinxcontrib-log-cabinet", ] docs-auto = [ "sphinx-autobuild", ] gha-update = [ "gha-update ; python_full_version >= '3.12'", ] pre-commit = [ "pre-commit", "pre-commit-uv", ] tests = [ "pytest", ] typing = [ "click>=8.3.1", "mypy", "pyright", "types-pygments>=2.19.0.20251121", ] [build-system] requires = ["flit_core>=3.11,<4"] build-backend = "flit_core.buildapi" [tool.flit.module] name = "pallets_sphinx_themes" [tool.flit.sdist] include = [ "CHANGES.md", "uv.lock" ] exclude = [ "docs/_build/", ] [tool.uv] default-groups = ["dev", "pre-commit", "tests", "typing"] [tool.pytest] testpaths = ["tests"] filterwarnings = [ "error", ] [tool.coverage.run] branch = true source = ["pallets_sphinx_themes"] [tool.coverage.paths] source = ["src", "*/site-packages"] [tool.coverage.report] exclude_also = [ "if t.TYPE_CHECKING", "raise NotImplementedError", ": \\.{3}", ] [tool.mypy] python_version = "3.12" files = ["src"] show_error_codes = true pretty = true strict = true [tool.ruff] src = ["src"] fix = true show-fixes = true output-format = "full" [tool.ruff.lint] select = [ "B", # flake8-bugbear "E", # pycodestyle error "F", # pyflakes "I", # isort "UP", # pyupgrade "W", # pycodestyle warning ] [tool.ruff.lint.isort] force-single-line = true order-by-type = false [tool.tox] env_list = [ "style", ] [tool.tox.env_run_base] description = "pytest on latest dependency versions" runner = "uv-venv-lock-runner" uv_python_preference = "managed" package = "wheel" wheel_build_env = ".pkg" constrain_package_deps = true use_frozen_constraints = true dependency_groups = ["tests"] commands = [[ "pytest", "-v", "--tb=short", "--basetemp={env_tmp_dir}", {replace = "posargs", default = [], extend = true}, ]] [tool.tox.env.style] description = "run all pre-commit hooks on all files" dependency_groups = ["pre-commit"] skip_install = true commands = [["pre-commit", "run", "--all-files"]] [tool.tox.env.typing] description = "run static type checkers" dependency_groups = ["tests", "typing"] commands = [ ["mypy"], ["pyright", "--verifytypes", "pallets_sphinx_themes", "--ignoreexternal"], ] [tool.tox.env.docs] description = "build docs" dependency_groups = ["docs"] commands = [["sphinx-build", "-E", "-W", "-b", "dirhtml", "docs", "docs/_build/dirhtml"]] [tool.tox.env.docs-auto] description = "continuously rebuild docs and start a local server" dependency_groups = ["docs", "docs-auto"] commands = [["sphinx-autobuild", "-W", "-b", "dirhtml", "--watch", "src", "docs", "docs/_build/dirhtml"]] [tool.tox.env.update-actions] description = "update GitHub Actions pins" labels = ["update"] dependency_groups = ["gha-update"] skip_install = true commands = [["gha-update"]] [tool.tox.env.update-pre_commit] description = "update pre-commit pins" labels = ["update"] dependency_groups = ["pre-commit"] skip_install = true commands = [["pre-commit", "autoupdate", "--freeze", "-j4"]] [tool.tox.env.update-requirements] description = "update uv lock" labels = ["update"] dependency_groups = [] no_default_groups = true skip_install = true commands = [["uv", "lock", {replace = "posargs", default = ["-U"], extend = true}]] pallets-pallets-sphinx-themes-17201d8/src/ 0000775 0000000 0000000 00000000000 15147620124 0020453 5 ustar 00root root 0000000 0000000 pallets-pallets-sphinx-themes-17201d8/src/pallets_sphinx_themes/ 0000775 0000000 0000000 00000000000 15147620124 0025055 5 ustar 00root root 0000000 0000000 pallets-pallets-sphinx-themes-17201d8/src/pallets_sphinx_themes/__init__.py 0000664 0000000 0000000 00000014271 15147620124 0027173 0 ustar 00root root 0000000 0000000 import inspect import os import re import sys import textwrap from collections import namedtuple from importlib import metadata as importlib_metadata from urllib.parse import urlsplit from sphinx.application import Sphinx from sphinx.builders.dirhtml import DirectoryHTMLBuilder from sphinx.errors import ExtensionError def setup(app): base = os.path.join(os.path.dirname(__file__), "themes") for name in os.listdir(base): path = os.path.join(base, name) if os.path.isdir(path): app.add_html_theme(name, path) app.add_config_value("is_pallets_theme", None, "html") app.add_config_value("rtd_canonical_path", "/en/stable/", "html") app.add_config_value("version_banner", True, "html") # Use the sphinx-notfound-page extension to generate a 404 page with valid # URLs. Only configure it if it's not already configured. if "notfound.extension" not in app.config.extensions: app.config.extensions.append("notfound.extension") app.config.notfound_context = { "title": "Page Not Found", "body": """
The page you requested does not exist. You may have followed a bad
link, or the page may have been moved or removed.
""",
}
if "READTHEDOCS" not in os.environ:
# Disable the default prefix outside of Read the Docs.
app.config.notfound_urls_prefix = None
app.connect("builder-inited", find_base_canonical_url)
app.connect("builder-inited", add_theme_files)
app.connect("html-page-context", canonical_url)
try:
app.connect("autodoc-skip-member", skip_internal)
app.connect("autodoc-process-docstring", cut_module_meta)
except ExtensionError:
pass
from .themes import click as click_ext
from .themes import jinja as jinja_ext
click_ext.setup(app)
jinja_ext.setup(app)
own_release, _ = get_version(__name__)
return {"version": own_release, "parallel_read_safe": True}
def find_base_canonical_url(app: Sphinx) -> None:
"""When building on Read the Docs, build the base canonical URL from the
environment variable if it's not given in the config. Replace the path with
``rtd_canonical_path``, which defaults to ``/en/stable/``.
"""
if app.config.html_baseurl:
return
if "READTHEDOCS_CANONICAL_URL" in os.environ:
parts = urlsplit(os.environ["READTHEDOCS_CANONICAL_URL"])
path = app.config.rtd_canonical_path
app.config.html_baseurl = f"{parts.scheme}://{parts.netloc}{path}"
def add_theme_files(app: Sphinx) -> None:
# Add the JavaScript for the version warning banner if ``version_banner`` is
# enabled. On Read the Docs, don't include it for stable or PR builds.
# Include the project and version as data attributes that the script will
# access. The project name is assumed to be the PyPI name, and is normalized
# to avoid a redirect.
rtd_version = os.environ.get("READTHEDOCS_VERSION")
rtd_version_type = os.environ.get("READTHEDOCS_VERSION_TYPE")
if app.config.version_banner and (
rtd_version is None # not on read the docs
or (rtd_version != "stable" and rtd_version_type in {"branch", "tag"})
):
app.add_js_file(
"describe_version.js",
**{
"data-project": re.sub(r"[-_.]+", "-", app.config.project).lower(),
"data-version": app.config.version,
},
)
def canonical_url(app: Sphinx, pagename, templatename, context, doctree):
"""Sphinx 1.8 builds a canonical URL if ``html_baseurl`` config is
set. However, it builds a URL ending with ".html" when using the
dirhtml builder, which is incorrect. Detect this and generate the
correct URL for each page.
"""
base = app.config.html_baseurl
if (
not base
or not isinstance(app.builder, DirectoryHTMLBuilder)
or not context["pageurl"]
or not context["pageurl"].endswith(".html")
):
return
# Fix pageurl for dirhtml builder if this version of Sphinx still
# generates .html URLs.
target = app.builder.get_target_uri(pagename)
context["pageurl"] = base + target
def skip_internal(app, what, name, obj, skip, options):
"""Skip rendering autodoc when the docstring contains a line with
only the string `:internal:`.
"""
docstring = inspect.getdoc(obj) or ""
if skip or re.search(r"^\s*:internal:\s*$", docstring, re.M) is not None:
return True
def cut_module_meta(app, what, name, obj, options, lines):
"""Don't render lines that start with ``:copyright:`` or
``:license:`` when rendering module autodoc. These lines are useful
meta information in the source code, but are noisy in the docs.
"""
if what != "module":
return
lines[:] = [
line for line in lines if not line.startswith((":copyright:", ":license:"))
]
def get_version(name, version_length=2, placeholder="x"):
"""Ensures that the named package is installed and returns version
strings to be used by Sphinx.
Sphinx uses ``version`` to mean an abbreviated form of the full
version string, which is called ``release``. In ``conf.py``::
release, version = get_version("Flask")
# release = 1.0.x, version = 1.0.3.dev0
:param name: Name of package to get.
:param version_length: How many values from ``release`` to use for
``version``.
:param placeholder: Extra suffix to add to the version. The default
produces versions like ``1.2.x``.
:return: ``(release, version)`` tuple.
"""
try:
release = importlib_metadata.version(name)
except ImportError:
print(
textwrap.fill(
f"'{name}' must be installed to build the documentation."
" Install from source using `pip install -e .` in a virtualenv."
)
)
sys.exit(1)
version = ".".join(release.split(".", version_length)[:version_length])
if placeholder:
version = f"{version}.{placeholder}"
return release, version
#: ``(title, url)`` named tuple that will be rendered with
ProjectLink = namedtuple("ProjectLink", ("title", "url"))
pallets-pallets-sphinx-themes-17201d8/src/pallets_sphinx_themes/themes/ 0000775 0000000 0000000 00000000000 15147620124 0026342 5 ustar 00root root 0000000 0000000 pallets-pallets-sphinx-themes-17201d8/src/pallets_sphinx_themes/themes/__init__.py 0000664 0000000 0000000 00000000000 15147620124 0030441 0 ustar 00root root 0000000 0000000 pallets-pallets-sphinx-themes-17201d8/src/pallets_sphinx_themes/themes/click/ 0000775 0000000 0000000 00000000000 15147620124 0027427 5 ustar 00root root 0000000 0000000 pallets-pallets-sphinx-themes-17201d8/src/pallets_sphinx_themes/themes/click/__init__.py 0000664 0000000 0000000 00000000256 15147620124 0031543 0 ustar 00root root 0000000 0000000 def setup(app):
"""Load the Click extension if Click is installed."""
try:
from . import domain
except ImportError:
return
domain.setup(app)
pallets-pallets-sphinx-themes-17201d8/src/pallets_sphinx_themes/themes/click/domain.py 0000664 0000000 0000000 00000017237 15147620124 0031262 0 ustar 00root root 0000000 0000000 import contextlib
import shlex
import subprocess
import sys
import tempfile
from functools import partial
import click
from click.testing import CliRunner
from click.testing import EchoingStdin
from docutils import nodes
from docutils.parsers.rst import Directive
from docutils.statemachine import ViewList
from sphinx.domains import Domain
class EofEchoingStdin(EchoingStdin):
"""Like :class:`click.testing.EchoingStdin` but adds a visible
``^D`` in place of the EOT character (``\x04``).
:meth:`ExampleRunner.invoke` adds ``\x04`` when
``terminate_input=True``.
"""
def _echo(self, rv):
eof = rv[-1] == b"\x04"[0]
if eof:
rv = rv[:-1]
if not self._paused:
self._output.write(rv)
if eof:
self._output.write(b"^D\n")
return rv
@contextlib.contextmanager
def patch_modules():
"""Patch modules to work better with :meth:`ExampleRunner.invoke`.
``subprocess.call` output is redirected to ``click.echo`` so it
shows up in the example output.
"""
old_call = subprocess.call
def dummy_call(*args, **kwargs):
with tempfile.TemporaryFile("wb+") as f:
kwargs["stdout"] = f
kwargs["stderr"] = f
rv = subprocess.Popen(*args, **kwargs).wait()
f.seek(0)
click.echo(f.read().decode("utf-8", "replace").rstrip())
return rv
subprocess.call = dummy_call
try:
yield
finally:
subprocess.call = old_call
class ExampleRunner(CliRunner):
def __init__(self):
super().__init__(echo_stdin=True)
self.namespace = {"click": click, "__file__": "dummy.py"}
@contextlib.contextmanager
def isolation(self, *args, **kwargs):
iso = super().isolation(*args, **kwargs)
with iso as streams:
try:
buffer = sys.stdin.buffer
except AttributeError:
buffer = sys.stdin
# FIXME: We need to replace EchoingStdin with our custom
# class that outputs "^D". At this point we know sys.stdin
# has been patched so it's safe to reassign the class.
# Remove this once EchoingStdin is overridable.
buffer.__class__ = EofEchoingStdin
yield streams
def invoke(
self,
cli,
args=None,
prog_name=None,
input=None,
terminate_input=False,
env=None,
_output_lines=None,
**extra,
):
"""Like :meth:`CliRunner.invoke` but displays what the user
would enter in the terminal for env vars, command args, and
prompts.
:param terminate_input: Whether to display "^D" after a list of
input.
:param _output_lines: A list used internally to collect lines to
be displayed.
"""
output_lines = _output_lines if _output_lines is not None else []
if env:
for key, value in sorted(env.items()):
value = shlex.quote(value)
output_lines.append(f"$ export {key}={value}")
args = args or []
if prog_name is None:
prog_name = cli.name.replace("_", "-")
output_lines.append(f"$ {prog_name} {shlex.join(args)}".rstrip())
# remove "python" from command
prog_name = prog_name.rsplit(" ", 1)[-1]
if isinstance(input, (tuple, list)):
input = "\n".join(input) + "\n"
if terminate_input:
input += "\x04"
result = super().invoke(
cli=cli, args=args, input=input, env=env, prog_name=prog_name, **extra
)
output_lines.extend(result.output.splitlines())
return result
def declare_example(self, source):
"""Execute the given code, adding it to the runner's namespace."""
with patch_modules():
code = compile(source, "Contents
{{ toc }}
{%- endif %}
pallets-pallets-sphinx-themes-17201d8/src/pallets_sphinx_themes/themes/pocoo/project.html 0000664 0000000 0000000 00000000255 15147620124 0032017 0 ustar 00root root 0000000 0000000 {% if project_links %}
Project Links
{% for item in project_links %}
{%- endif %}
pallets-pallets-sphinx-themes-17201d8/src/pallets_sphinx_themes/themes/pocoo/relations.html 0000664 0000000 0000000 00000001205 15147620124 0032345 0 ustar 00root root 0000000 0000000 Navigation
pallets-pallets-sphinx-themes-17201d8/src/pallets_sphinx_themes/themes/pocoo/static/ 0000775 0000000 0000000 00000000000 15147620124 0030750 5 ustar 00root root 0000000 0000000 pallets-pallets-sphinx-themes-17201d8/src/pallets_sphinx_themes/themes/pocoo/static/atkinson/ 0000775 0000000 0000000 00000000000 15147620124 0032576 5 ustar 00root root 0000000 0000000 AtkinsonHyperlegibleMonoVF-Variable.woff2 0000664 0000000 0000000 00000114754 15147620124 0042432 0 ustar 00root root 0000000 0000000 pallets-pallets-sphinx-themes-17201d8/src/pallets_sphinx_themes/themes/pocoo/static/atkinson wOF2 ™ì 9$ ™ƒ ± ˆn`?STAT*'8 ‰/|
®ˆX…\ 0‚°6$‹4 š[g"q@6†£cy»IUf°Ù÷Ïp ó¬ïàn%™š4>áŽyàpi’ýÿŸ’ÔÆÈ4œI‹ˆ¼âFåÌ"êgÏ0P•¸4³tÞX¿Ž>pwTa<ðY¹å…S/Ü‚V07Ô`¦ÆŒSÂebˆ-¨½+ž‚»ÙF÷Þî
ËW†T¨3L¡’wþ%Œ!ô搜u³Å7
dÐAÂn‡©˜¢"jZƒ¦*|
#nWBÑ‚óB>~æÜts‡)¦
ñ¹õÿ€Âd›Zó ‹À¸5–ª™—œÑ¦³w?xâM‰ŠÖÄ…Ÿp©ý¼7 ¬–¼ël󛥜+ úÚäHò!‡\<Âß²ôš‡
ã²Vxg«OÚ´˜6©èTÇ…ÁôD½æ¹þ‰këÎÂ0Öc´½Õæ‚h3“öC"“ˆD“éZò‡FÓsÃÓtþk›Ö)5M£r¹$•‹xcR³Õ(PFa”ŽN”·Ø„"6Çfˆñþ÷ùûøðÄÿå{çýÝß„Rié¢@ VHŽG0`øÿï¾Ï½Ïª×S½×Cë #&`%4.oÀlÀ 0€0Íû_ýwY`J2óàv¹ª÷l×Zš,AUîé·ì ø=Žc[’ÿýOÍ{ËãsÁñwj©Ûxw%“ÏREÒÑl¾¶Ö&)cmcKÓä·Ù´ÿºgF’%Ë~@}<¢ˆ!¼ì’äºÛãÝOÑA!GˆÁ»¶×5ü_¿fíU=iä!N2ªD¶ß|ùÏ,ÿfQÕ":!fh§ih DÌGÌÿüçV߇mj“zâOÜÇt9‹u‡{ýºTkÓ…Â,„$ĈLæö:F&z¨Ó¤>ýoe‚u cì €#7 ƒ@¶¡Û{Ê@l‡Û ž×›s:몢ÂñÜllWIõC@ÎÞðü·×”êjÈÿîϵ0™y3 f|öͶ§·ãÒÇãÖd¹iåŠJKi€á-(¥³°Àœ BÃ`àÿ¿U5›·^ÄDÿÞgó=B"\‘8$J¢ŠHúäTFþŽYöê¹®–rE²JN‡pƒF!—ÍrP
ã™ÿ9Óæa:byv$*=!ÓýM~J¿=J®=@Êo9סºº7Åìüf'ä|ú^gßö‹…Ÿý“ìIOºô¤kÿô{% for parent in parents %}
{% endif %}
{% endif %}{% endfor %}
{% if prev %}