installer dont cache states

Signed-off-by: Vladimir Mandic <mandic00@live.com>
pull/4013/head
Vladimir Mandic 2025-07-01 17:48:31 -04:00
parent 71bcb5b8ad
commit adcee933da
3 changed files with 2 additions and 8 deletions

View File

@ -12,6 +12,7 @@
- better handle startup import errors
- **Fixes**
- allow theme type `None` to be set in config
- installer dont cache installed state
## Update for 2025-06-30

View File

@ -1,4 +1,3 @@
from functools import lru_cache
import os
import sys
import json
@ -254,7 +253,6 @@ def print_profile(profiler: cProfile.Profile, msg: str):
profile(profiler, msg)
@lru_cache()
def package_version(package):
try:
return pkg_resources.get_distribution(package).version
@ -262,7 +260,6 @@ def package_version(package):
return None
@lru_cache()
def package_spec(package):
spec = pkg_resources.working_set.by_key.get(package, None) # more reliable than importlib
if spec is None:
@ -273,7 +270,6 @@ def package_spec(package):
# check if package is installed
@lru_cache()
def installed(package, friendly: str = None, reload = False, quiet = False): # pylint: disable=redefined-outer-name
t_start = time.time()
ok = True
@ -341,7 +337,6 @@ def run(cmd: str, arg: str):
return txt
@lru_cache()
def pip(arg: str, ignore: bool = False, quiet: bool = True, uv = True):
t_start = time.time()
originalArg = arg
@ -376,7 +371,6 @@ def pip(arg: str, ignore: bool = False, quiet: bool = True, uv = True):
# install package using pip if not already installed
@lru_cache()
def install(package, friendly: str = None, ignore: bool = False, reinstall: bool = False, no_deps: bool = False, quiet: bool = False, force: bool = False):
t_start = time.time()
res = ''
@ -396,7 +390,6 @@ def install(package, friendly: str = None, ignore: bool = False, reinstall: bool
# execute git command
@lru_cache()
def git(arg: str, folder: str = None, ignore: bool = False, optional: bool = False): # pylint: disable=unused-argument
t_start = time.time()
if args.skip_git:

View File

@ -353,7 +353,7 @@ def start_ui():
timer.startup.record("app-started")
time_sorted = sorted(modules.scripts.time_setup.items(), key=lambda x: x[1], reverse=True)
time_script = [f'{k}:{round(v,3)}' for (k,v) in time_sorted if v > 0.01]
time_script = [f'{k}:{round(v,3)}' for (k,v) in time_sorted if v > 0.03]
time_total = sum(modules.scripts.time_setup.values())
shared.log.debug(f'Scripts setup: time={time_total:.3f} {time_script}')
time_component = [f'{k}:{round(v,3)}' for (k,v) in modules.scripts.time_component.items() if v > 0.005]