Skip to main content

MkDocs Build Cache Plugin

MkDocs Build Cache Plugin is a MkDocs plugin that speeds up your documentation builds by caching the build state. It computes a unique hash based on your configuration, source files, and any additional files you wish to include. If nothing has changed since the last build and your output directory already contains valid content, the plugin can abort the build early, saving valuable time.

Installation

Install the plugin via pip:

pip install mkdocs-build-cache-plugin

Alternatively, add it to your project’s dependencies.

Usage

To enable the plugin, add it to your mkdocs.yml configuration file. You can also pass an optional list of glob patterns to include additional files in the cache hash computation.

site_name: My Docs Site

plugins:
  - search
  - build_cache:
      include:
        - "extras/*.txt"
        - "assets/**/*.css"

How It Works

  1. Cache ID Calculation:
    When MkDocs starts, the plugin calculates a unique cache ID based on:

    • The main configuration file (if available).
    • All files under your docs_dir.
    • Any extra files that match the glob patterns provided in the include option.
  2. Build Skipping:

    • If a cache file exists and its cache ID matches the newly computed one and the output directory (site_dir) exists and is nonempty, the plugin raises an abort exception. This tells MkDocs that the build is up to date, and it can safely skip rebuilding.
    • Otherwise, the build proceeds normally. After a successful build, the plugin updates the cache file with the new cache ID.

Configuration Options

include

  • Type: List[str]

  • Default: []

  • Description:
    A list of glob patterns specifying extra files to be included in the cache hash computation. For example:

    include:
      - "extras/*.txt"
      - "assets/**/*.css"
    

Development

To run tests locally, ensure you have pytest installed and run:

pytest

Logging

This plugin uses the mkdocs.plugins logger namespace. You can control the log output via MkDocs’ verbosity flags (e.g., --verbose or --debug).

Contributing

Contributions, suggestions, and bug reports are welcome! Please open an issue or submit a pull request in the project's repository.

License

This project is licensed under the MIT License.

Metadata

Release files for mkdocs-build-cache-plugin 0.3.0

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

Source distribution (sdist)

Source distribution for mkdocs-build-cache-plugin 0.3.0
File Size Uploaded Provenance
mkdocs_build_cache_plugin-0.3.0.tar.gz 6.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mkdocs-build-cache-plugin 0.3.0
File Interpreter ABI Platform
mkdocs_build_cache_plugin-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.7 kB

Release files / mkdocs_build_cache_plugin-0.3.0.tar.gz

Download URL mkdocs_build_cache_plugin-0.3.0.tar.gz
Size 6.3 kB
Tags Source
SHA-256 checksum
How to use checksums
7bb3ef55d5939197cb83ea7252d3b2412fe7ee0ff85dc825823b1b014cb1be84
BLAKE2b-256 checksum
How to use checksums
d2df683d555a901f4b97d3b621362e7f54e9fa9d085326a1e5dba3e406c50203
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Release files / mkdocs_build_cache_plugin-0.3.0-py3-none-any.whl

Download URL mkdocs_build_cache_plugin-0.3.0-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7e6994b594ab394ceb27b0f18a85b38fbb82d8818492a72f6218f7c8bb882599
BLAKE2b-256 checksum
How to use checksums
679958297a2ea252169a27aa37d67de76695f932881c7ee96a9eaf53e06dee45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Security for mkdocs-build-cache-plugin 0.3.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

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