Repository navigation
Keep the mkdocs command working with upstream MkDocs 2.0's launcher - #127
Merged
Merged
Conversation
Upstream MkDocs 2.0 pre-releases install a `mkdocs` launcher that runs `from mkdocs import cli`. When a plugin pulls one in next to MkDocs NG, that launcher replaces ours and fails with ImportError. Provide `mkdocs.cli` lazily so it runs the MkDocs NG command line.
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Upstream MkDocs 2.0 pre-releases (e.g.
mkdocs==2.0.dev6) install amkdocslauncher that runs:Since #115 both packages provide the
mkdocscommand. If a plugin's dependencies (oruv pip install --prerelease allow) pull in a 2.0 pre-release, its launcher replaces ours, and with MkDocs NG loaded asmkdocsit fails withImportError: cannot import name 'cli' from 'mkdocs'.Fix
A module-level
__getattr__inmkdocs/__init__.pyreturnsmkdocs.__main__.cliforcli, imported lazily soimport mkdocsstays cheap. Unknown names still raiseAttributeError.Testing
from mkdocs import cliis the MkDocs NG click group; other names raiseAttributeError.mkdocs-material, thenuv pip install --prerelease allow "mkdocs==2.0.dev6". The launcher is upstream's (from mkdocs import cli);mkdocs --versionreports MkDocs NG fromsite-packages/mkdocs_ng/mkdocs, and a Material site withsearch+llms_txtbuilds.Release notes: new
Version 1.10.0 (2026-xx-xx)section listing changes since 1.10.0rc1.Generated by Claude Code