Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions properdocs/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,7 @@

import click

from properdocs import (
__version__,
config,
replacement, # noqa: F401
utils,
)
from properdocs import __version__, config, replacement, utils

if sys.platform.startswith("win"):
try:
Expand All @@ -27,6 +22,9 @@
else:
colorama.init()

replacement.setup()


log = logging.getLogger(__name__)


Expand Down
14 changes: 10 additions & 4 deletions properdocs/replacement.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
"""After this file is imported, all mkdocs.* imports get redirected to properdocs.* imports."""
"""After calling setup(), all mkdocs.* imports get redirected to properdocs.* imports."""

import importlib.abc
import importlib.util
import os
import sys


Expand Down Expand Up @@ -37,6 +38,11 @@ def find_spec(self, fullname, path, target=None):
return None


sys.meta_path.insert(0, _AliasFinder())
# Plus, handle the topmost module directly and without waiting for it to be requested.
sys.modules['mkdocs'] = sys.modules['properdocs']
def setup():
sys.meta_path.insert(0, _AliasFinder())
# Plus, handle the topmost module directly and without waiting for it to be requested.
sys.modules['mkdocs'] = sys.modules['properdocs']

# Prevent warnings from the theme that already uses this environment variable.
# That warning does not apply to ProperDocs.
os.environ['NO_MKDOCS_2_WARNING'] = 'true'
Loading