Change pip constraints handling...

...and set "uv" and "constraints" parameters to keyword-only
This commit is contained in:
awsr
2026-04-28 01:22:27 -07:00
parent b37fff1237
commit aff3bf415a
+4 -4
View File
@@ -38,8 +38,7 @@ debug = log.debug if os.environ.get('SD_INSTALL_DEBUG', None) is not None else l
setuptools, distutils = None, None # defined via ensure_base_requirements
current_branch = None
pip_log = '--log pip.log' if os.environ.get('SD_PIP_DEBUG', None) is not None else ''
main_directory = os.path.dirname(os.path.abspath(__file__))
log_file = os.path.join(main_directory, 'sdnext.log')
log_file = os.path.join(os.path.dirname(__file__), 'sdnext.log')
hostname = socket.gethostname()
log_rolled = False
first_call = True
@@ -245,7 +244,7 @@ def cleanup_broken_packages():
pass
def pip(arg: str, ignore: bool = False, quiet: bool = True, uv = True) -> tuple[subprocess.CompletedProcess, str]:
def pip(arg: str, ignore: bool = False, quiet: bool = True, *, uv = True, constraints = True) -> tuple[subprocess.CompletedProcess, str]:
t_start = time.time()
originalArg = arg
arg = arg.replace('>=', '==').strip()
@@ -264,6 +263,8 @@ def pip(arg: str, ignore: bool = False, quiet: bool = True, uv = True) -> tuple[
all_args.append(arg)
if env_args:
all_args.append(env_args)
if constraints and "-c " not in env_args:
all_args.append("-c constraints.txt")
if not quiet:
log.debug(f'Running: {pipCmd}="{" ".join(all_args)}"')
@@ -1287,7 +1288,6 @@ def install_requirements():
# set environment variables controling the behavior of various libraries
def set_environment():
log.debug('Setting environment tuning')
os.environ.setdefault('PIP_CONSTRAINT', os.path.join(main_directory, 'constraints.txt'))
os.environ.setdefault('ACCELERATE', 'True')
os.environ.setdefault('ATTN_PRECISION', 'fp16')
os.environ.setdefault('ClDeviceGlobalMemSizeAvailablePercent', '100')