Skip to content

Don't show the "switch to ProperDocs" warning under MkDocs NG - #123

Merged
shenxianpeng merged 2 commits into
mainfrom
claude/project-thread-8gce4u
Nov 1, 2026
Merged

shenxianpeng merged 2 commits into
mainfrom
claude/project-thread-8gce4u

Conversation

@shenxianpeng

@shenxianpeng shenxianpeng commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

The latest releases of several popular plugins (mkdocs-redirects, mkdocs-gen-files, mkdocs-literate-nav, mkdocs-section-index, mkdocs-rss-plugin) depend on properdocs and call properdocs.replacement_warning.setup() at import. When they run under the mkdocs command, this prints a long warning: "MkDocs 2.0" could replace what pip install mkdocs installs, 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, so DISABLE_MKDOCS_2_WARNING=false shows the warning again. mkdocs.build() / mkdocs.serve() aren't affected: ProperDocs only warns when sys.argv[0] is mkdocs.

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.0 section 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

  • New tests added for new behavior: test_build_disables_properdocs_warning and test_build_keeps_user_properdocs_warning_setting in cli_tests.py
  • Documentation updated (release notes describe the variable)
  • Release notes docs/about/release-notes.md updated

Tested 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-redirects 1.2.3 installed: the ProperDocs warning appears 0 times by default and comes back with DISABLE_MKDOCS_2_WARNING=false.

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.
@shenxianpeng shenxianpeng self-assigned this Nov 1, 2026
@codspeed

codspeed Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 28 untouched benchmarks


Comparing claude/project-thread-8gce4u (dffc3d2) with main (25745a3)

Open in CodSpeed

# Conflicts:
#	docs/about/release-notes.md
@shenxianpeng
shenxianpeng merged commit 9641bf8 into main Nov 1, 2026
23 checks passed
@shenxianpeng
shenxianpeng deleted the claude/project-thread-8gce4u branch November 1, 2026 09:32
This was referenced Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant