feat(install): use uv

한국인이 원하는 속도감
pull/601/head^2
Dowon 2024-05-19 16:54:51 +09:00
parent 1bcc00c3b9
commit e44872e775
1 changed files with 14 additions and 2 deletions

View File

@ -1,6 +1,7 @@
from __future__ import annotations
import importlib.util
import os
import subprocess
import sys
from importlib.metadata import version # python >= 3.8
@ -38,7 +39,11 @@ def is_installed(
def run_pip(*args):
subprocess.run([sys.executable, "-m", "pip", "install", *args])
subprocess.run([sys.executable, "-m", "pip", "install", *args], check=False)
def run_uv_pip(*args):
subprocess.run([sys.executable, "-m", "uv", "pip", "install", *args], check=False)
def install():
@ -51,6 +56,12 @@ def install():
("protobuf", "4.25.3", "4.9999"),
]
if not is_installed("uv", "0.1.44", None):
run_pip("uv>=0.1.44")
os.environ["UV_PYTHON"] = sys.executable
pkgs = []
for pkg, low, high in deps:
if not is_installed(pkg, low, high):
if low and high:
@ -61,8 +72,9 @@ def install():
cmd = f"{pkg}<={high}"
else:
cmd = pkg
pkgs.append(cmd)
run_pip("-U", cmd)
run_uv_pip(*pkgs)
try: