skillfed

sphinx-remove-toctrees

Reduce your documentation build size by selectively removing toctrees from pages.

sphinx-remove-toctrees v1.0.0.post1 147.9K downloads/30d#11,050 on PyPI15
Permissive license MIT License Copyright (c) 2018 Chris Holdgraf Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to… (full text in the JSON record) DORMANT released

What it is and what it does

sphinx-remove-toctrees is a Sphinx extension that speeds up documentation builds by removing toctree objects from pages you specify. It works by intercepting Sphinx's build process after the initial validation phase but before HTML rendering, selectively deleting toctree entries that match glob-like patterns you configure in conf.py. This is most useful when your documentation uses autosummary to generate many stub pages—each one adds overhead to the build, especially in themes that render the entire table of contents on every page.

You configure it by adding a list of glob patterns to a `remove_from_toctrees` key in conf.py, specifying which pages should be removed from the sidebar. The extension ensures no warnings are raised about missing files while still removing them from the rendered navigation, avoiding the link-resolution overhead that slows large builds.

Use it for:

  • Speed up Sphinx builds for projects with auto-generated API documentation using autosummary
  • Remove stub pages from sidebar navigation without triggering missing-file warnings
  • Optimize documentation rendering for themes with collapsible sidebar sections
  • Reduce build time for large nested documentation hierarchies
  • Selectively hide generated API pages from table of contents while keeping them accessible

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

A Sphinx extension that selectively removes toctree objects from specified pages to reduce documentation build time, particularly for projects with large auto-generated API documentation.

Yes, if you maintain Sphinx documentation with large auto-generated API sections and experience slow builds. The extension is straightforward to configure, has no complex dependencies, and solves a specific performance problem. The dormant maintenance status is acceptable for a focused, stable tool—no active vulnerabilities and it supports current Python versions.

Install

sphinx-remove-toctrees on PyPI

pip

pip install sphinx-remove-toctrees

uv

uv add sphinx-remove-toctrees

poetry

poetry add sphinx-remove-toctrees

Installing sphinx-remove-toctrees

Before you install

Low friction: pure Python wheel with only sphinx as a runtime dependency. Maintenance is dormant—last release was 875 days ago, though the repository remains active and unarchived.

License in practice

MIT License permits unrestricted use, modification, and distribution with minimal restrictions, making it safe for both open-source and commercial projects.

Quickstart

pip install sphinx-remove-toctrees

In conf.py:
extensions.append("sphinx_remove_toctrees")
remove_from_toctrees = ["api/generated/*", "subfolder/page_two.rst"]

Verify before relying

  • Performance improvement magnitude for typical documentation projects with large API docs
  • Compatibility with specific Sphinx themes beyond those mentioned in the description

Package facts

License MIT License Copyright (c) 2018 Chris Holdgraf Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to… (full text in the JSON record) (permissive)
Python support supports the current Python release (>=3.9)
Install friction low — pure-Python wheel
Runtime dependencies 1 — sphinx
Maintenance dormant — 875 days since the last release
Last repo commit
First released
Downloads 147,888/month — #11,050 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: sphinx_remove_toctrees-1.0.0.post1-py3-none-any.whl

License :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.9

Tags

sphinx build performance optimizationremove toctree sidebar linkssphinx documentation speedapi documentation build timesphinx extension toctreereduce sphinx build sizeautosummary page optimization
sphinx-extensionbuild-optimizationdocumentation

More Sphinx packages

docstring-parser

Parses Python docstrings in ReST, Google,…

permissive · top 1,000 on PyPI

Sphinx

Sphinx generates professional documentation…

permissive · top 1,000 on PyPI

sphinxcontrib-serializinghtml

A Sphinx extension that outputs documentation…

permissive · top 1,000 on PyPI

alabaster

Alabaster is a clean, responsive Sphinx theme…

permissive · top 1,000 on PyPI

sphinxcontrib-htmlhelp

A Sphinx extension that generates HTML help…

permissive · top 1,000 on PyPI

sphinxcontrib-qthelp

A Sphinx extension that converts documentation…

permissive · top 1,000 on PyPI

sphinx_external_toc

A Sphinx extension that defines documentation…

permissive · top 15,000 on PyPI

sphinx-multitoc-numbering

A Sphinx extension that maintains continuous…

permissive · top 15,000 on PyPI

sphinx-reredirects

Sphinx extension that generates HTML redirect…

unclear · top 5,000 on PyPI

sphinx-autosummary-accessors

A Sphinx extension that generates proper…

permissive · top 15,000 on PyPI

sphinxext-rediraffe

A Sphinx extension that automatically redirects…

permissive · top 15,000 on PyPI

sphinx-jupyterbook-latex

A Sphinx extension that adds LaTeX output…

permissive · top 15,000 on PyPI

sphinx-simplepdf

Sphinx-SimplePDF is a Sphinx extension that…

permissive · top 15,000 on PyPI

sphinx-last-updated-by-git

A Sphinx extension that automatically extracts…

permissive · top 15,000 on PyPI

autodocsumm

A Sphinx extension that enhances autodoc with…

permissive · top 5,000 on PyPI

sphinx-togglebutton

A Sphinx extension that adds collapsible toggle…

permissive · top 15,000 on PyPI