Install & Compatibility
Where this runs
tested against v0.1.5 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 33MB
glibcpy 3.10–3.920 runs
installs and imports cleanly · install 3.0s · import 0.000s · 34MB
32MB installed
● package 32MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Hook definition in mkdocs.yml
✓ plugins:
- mkdocs-simple-hooks:
hooks:
on_pre_build: "docs.hooks:copy_readme"
Hooks are defined as Python functions in a module (e.g., 'docs/hooks.py') and referenced as a string in mkdocs.yml, not directly imported into Python code.
To get started, define your hook functions in a Python file (e.g., `docs/hooks.py`) and then reference these functions in your `mkdocs.yml` configuration under the `plugins.mkdocs-simple-hooks.hooks` section. The example demonstrates copying `README.md` to `docs/index.md` before the build process.
# 1. Create a Python file, e.g., 'docs/hooks.py'
# content of docs/hooks.py:
import shutil
def copy_readme(*args, **kwargs):
shutil.copy('README.md', 'docs/index.md')
# 2. Configure mkdocs.yml (add this to your existing mkdocs.yml):
# plugins:
# - mkdocs-simple-hooks:
# hooks:
# on_pre_build: "docs.hooks:copy_readme"
# 3. Ensure 'mkdocs' is installed and run from your project root:
# pip install mkdocs
# mkdocs build
# mkdocs serve
Debug
Known issues
breakingThis plugin is officially deprecated and no longer supported as MkDocs 1.4.0 and later versions include native support for hooks, making this plugin redundant. Users are strongly advised to migrate to the native MkDocs hooks functionality.fixRemove `mkdocs-simple-hooks` from `mkdocs.yml` and `requirements.txt`. Refactor hook functions to be directly referenced under the `hooks:` configuration in `mkdocs.yml` as per MkDocs documentation.
affects: All versions of mkdocs-simple-hooks with MkDocs >= 1.4.0
gotchaIf you don't have a `plugins` entry in your `mkdocs.yml`, MkDocs typically enables the `search` plugin by default. When you add `mkdocs-simple-hooks`, you must explicitly list `search` if you still want it, as adding any plugin disables implicit defaults.fixEnsure your `mkdocs.yml` explicitly lists all desired plugins: `plugins: [search, mkdocs-simple-hooks]`
affects: All versions
gotchaTo enable/disable the plugin dynamically, especially in different environments, you can use MkDocs' `!ENV` tag with an environment variable. Without careful handling, the plugin might be active when not intended or vice-versa.fixConfigure in `mkdocs.yml`: `plugins: - mkdocs-simple-hooks: enabled: !ENV [ENABLE_MKDOCS_SIMPLE_HOOKS, True]` and set `ENABLE_MKDOCS_SIMPLE_HOOKS` accordingly in your environment.
affects: All versions
Upgrade
Version history
0.1.5latest on PyPI · released Jan 7, 2022
Audit
Dependencies
mkdocsrequiredThis is an MkDocs plugin and requires MkDocs to function.