Repository navigation
Don't show the "switch to ProperDocs" warning under MkDocs NG - #123
Merged
Merged
Conversation
mkdocs-redirects, mkdocs-gen-files, mkdocs-literate-nav, mkdocs-section-index and mkdocs-rss-plugin call properdocs.replacement_warning.setup(), which prints a long warning whenever they run under the `mkdocs` command: "MkDocs 2.0" could replace what `pip install mkdocs` installs, so switch to ProperDocs. That doesn't apply to MkDocs NG. The CLI now sets DISABLE_MKDOCS_2_WARNING=true, the variable the warning itself names, before any plugin is loaded. A value the user has set is kept, so DISABLE_MKDOCS_2_WARNING=false shows the warning again.
Contributor
# Conflicts: # docs/about/release-notes.md
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.
The latest releases of several popular plugins (
mkdocs-redirects,mkdocs-gen-files,mkdocs-literate-nav,mkdocs-section-index,mkdocs-rss-plugin) depend onproperdocsand callproperdocs.replacement_warning.setup()at import. When they run under themkdocscommand, this prints a long warning: "MkDocs 2.0" could replace whatpip install mkdocsinstalls, so switch to ProperDocs. Every MkDocs NG build that uses one of them shows it, but the warning doesn't apply to MkDocs NG.The CLI group now runs
os.environ.setdefault("DISABLE_MKDOCS_2_WARNING", "true")before any plugin is loaded. That's the opt-out the warning names itself. If the user has already set the variable, their value is kept, soDISABLE_MKDOCS_2_WARNING=falseshows the warning again.mkdocs.build()/mkdocs.serve()aren't affected: ProperDocs only warns whensys.argv[0]ismkdocs.Merge after #115. Once #115 is in, upstream releases can no longer overwrite MkDocs NG's files, so the warning's premise is fully false for MkDocs NG users. Both PRs add a
Version 1.10.0section to the release notes, so whichever merges second needs a small merge.Related Issue
None. This is item 2 of the post-1.9.0 priority list.
Checklist
test_build_disables_properdocs_warningandtest_build_keeps_user_properdocs_warning_settingincli_tests.pydocs/about/release-notes.mdupdatedTested locally: the full unit test suite passes (925 tests), as do mypy and pre-commit. I also ran an end-to-end build with
mkdocs-redirects1.2.3 installed: the ProperDocs warning appears 0 times by default and comes back withDISABLE_MKDOCS_2_WARNING=false.