Avoid loading pkg_resources until needed
This import took forever (0.2s) and was used only for the version command, so don't import it except where it's needed.
This commit is contained in:
parent
198d083ea6
commit
2ee2b2cb33
|
@ -25,9 +25,8 @@ from functools import wraps
|
||||||
from json import dump as jdump
|
from json import dump as jdump
|
||||||
from json import dumps as jdumps
|
from json import dumps as jdumps
|
||||||
from json import loads as jloads
|
from json import loads as jloads
|
||||||
from os import environ, makedirs, path
|
|
||||||
from pkg_resources import get_distribution
|
|
||||||
from lxml.etree import fromstring, tostring
|
from lxml.etree import fromstring, tostring
|
||||||
|
from os import environ, makedirs, path
|
||||||
from re import sub, match
|
from re import sub, match
|
||||||
from yaml import load as yload
|
from yaml import load as yload
|
||||||
from yaml import SafeLoader as SafeYAMLLoader
|
from yaml import SafeLoader as SafeYAMLLoader
|
||||||
|
@ -115,6 +114,8 @@ def version(ctx, param, value):
|
||||||
if not value or ctx.resilient_parsing:
|
if not value or ctx.resilient_parsing:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
from pkg_resources import get_distribution
|
||||||
|
|
||||||
version = get_distribution("pvc").version
|
version = get_distribution("pvc").version
|
||||||
echo(CLI_CONFIG, f"Parallel Virtual Cluster CLI client version {version}")
|
echo(CLI_CONFIG, f"Parallel Virtual Cluster CLI client version {version}")
|
||||||
ctx.exit()
|
ctx.exit()
|
||||||
|
|
Loading…
Reference in New Issue