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:
Joshua Boniface 2023-10-25 01:51:08 -04:00
parent 198d083ea6
commit 2ee2b2cb33
1 changed files with 3 additions and 2 deletions

View File

@ -25,9 +25,8 @@ from functools import wraps
from json import dump as jdump
from json import dumps as jdumps
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 os import environ, makedirs, path
from re import sub, match
from yaml import load as yload
from yaml import SafeLoader as SafeYAMLLoader
@ -115,6 +114,8 @@ def version(ctx, param, value):
if not value or ctx.resilient_parsing:
return
from pkg_resources import get_distribution
version = get_distribution("pvc").version
echo(CLI_CONFIG, f"Parallel Virtual Cluster CLI client version {version}")
ctx.exit()