From 4a6862a82a33a39c67f646d1fb70de86353fcce1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Mond=C3=A9jar?= Date: Thu, 30 Dec 2021 22:07:31 +0100 Subject: [PATCH] Don't import unused commands (#2714) --- mkdocs/__main__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mkdocs/__main__.py b/mkdocs/__main__.py index 33758c66..2f1944d3 100644 --- a/mkdocs/__main__.py +++ b/mkdocs/__main__.py @@ -10,7 +10,6 @@ import shutil from mkdocs import __version__ from mkdocs import utils from mkdocs import config -from mkdocs.commands import build, gh_deploy, new, serve if sys.platform.startswith("win"): @@ -177,6 +176,7 @@ def cli(): @common_options def serve_command(dev_addr, livereload, watch, **kwargs): """Run the builtin development server""" + from mkdocs.commands import serve serve.serve(dev_addr=dev_addr, livereload=livereload, watch=watch, **kwargs) @@ -187,6 +187,7 @@ def serve_command(dev_addr, livereload, watch, **kwargs): @common_options def build_command(clean, **kwargs): """Build the MkDocs documentation""" + from mkdocs.commands import build build.build(config.load_config(**kwargs), dirty=not clean) @@ -208,6 +209,7 @@ def gh_deploy_command(clean, message, remote_branch, remote_name, force, ignore_ remote_name=remote_name, **kwargs ) + from mkdocs.commands import build, gh_deploy build.build(cfg, dirty=not clean) gh_deploy.gh_deploy(cfg, message=message, force=force, ignore_version=ignore_version, shell=shell) @@ -217,6 +219,7 @@ def gh_deploy_command(clean, message, remote_branch, remote_name, force, ignore_ @common_options def new_command(project_directory): """Create a new MkDocs project""" + from mkdocs.commands import new new.new(project_directory)