File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change 1- import click
21import importlib
2+ import sys
3+
4+ import click
35
46
57@click .group (help = "Manage project based on custom Docker image" )
@@ -18,6 +20,9 @@ def cli():
1820 "check" ,
1921]
2022
23+ if len (sys .argv ) > 2 and sys .argv [2 ] in module_deps :
24+ module_deps = [sys .argv [2 ]]
25+
2126for command in module_deps :
2227 module_path = "shub.image." + command
2328 command_module = importlib .import_module (module_path )
Original file line number Diff line number Diff line change 11from __future__ import absolute_import
22import importlib
3+ import sys
34
45import click
56
@@ -51,6 +52,12 @@ def cli():
5152 "image" ,
5253]
5354
55+ # Some imports, particularly requests and pip, are very slow. To avoid
56+ # importing these modules when running a command that doesn't need them, we
57+ # import that command module only.
58+ if len (sys .argv ) > 1 and sys .argv [1 ] in commands :
59+ commands = [sys .argv [1 ]]
60+
5461for command in commands :
5562 module_path = "shub." + command
5663 command_module = importlib .import_module (module_path )
You can’t perform that action at this time.
0 commit comments