MkDocs Get Deps
mkdocs-get-deps is an extra command-line tool for MkDocs that simplifies dependency management by inferring required PyPI packages from `plugins`, `themes`, and `markdown_extensions` listed in an `mkdocs.yml` configuration file. It outputs the names of these packages, making it easy to pipe them directly to `pip install`. The current version is 0.2.2. It's a low-cadence utility, typically updated in sync with MkDocs or its dependency catalog.
Warnings
- gotcha Directly chaining `pip install $(mkdocs get-deps)` is convenient but does not pin dependency versions. For stable environments (e.g., CI/CD), it's recommended to write dependencies to a `requirements.txt` file and install from there to ensure reproducible builds.
- gotcha `mkdocs-get-deps` relies on an official catalog of known MkDocs plugins, themes, and extensions. If you use a custom or very niche plugin/theme not listed in the catalog, `mkdocs get-deps` might not be able to infer its dependencies.
- gotcha It is highly recommended to use `mkdocs-get-deps` within a Python virtual environment to isolate your project's dependencies from your system's Python installation and prevent dependency conflicts.
Install
-
pip install mkdocs-get-deps
Quickstart
# Create a sample MkDocs project (if you don't have one) # mkdocs new my-docs # cd my-docs # Assuming you have an mkdocs.yml in the current directory, e.g., with a plugin configured: # plugins: # - search # Print the inferred dependencies mkdocs get-deps # Install the inferred dependencies pip install $(mkdocs get-deps)