forked from phoenix/litellm-mirror
clean up print statements
This commit is contained in:
parent
972063872f
commit
0fc4d9e29c
2 changed files with 10 additions and 6 deletions
|
@ -48,20 +48,24 @@ def install_and_import(package: str):
|
||||||
required = [req for req in pkg_resources.get_distribution(package).requires()]
|
required = [req for req in pkg_resources.get_distribution(package).requires()]
|
||||||
|
|
||||||
# Print the version of the package
|
# Print the version of the package
|
||||||
print(f"{package} version: {dist.version}")
|
# print(f"{package} version: {dist.version}")
|
||||||
# Check if there are dependencies
|
# Check if there are dependencies
|
||||||
if required:
|
if required:
|
||||||
for req in required:
|
for req in required:
|
||||||
install_and_import(req.project_name)
|
install_and_import(req.project_name)
|
||||||
else:
|
else:
|
||||||
print(f"{package} has been successfully installed with no dependencies.")
|
print_verbose(f"{package} has been successfully installed with no dependencies.")
|
||||||
|
|
||||||
|
except (ModuleNotFoundError, ImportError):
|
||||||
|
print_verbose(f"{package} is not installed. Installing...")
|
||||||
|
subprocess.call([sys.executable, "-m", "pip", "install", package])
|
||||||
|
globals()[package] = importlib.import_module(package)
|
||||||
except (DistributionNotFound, ImportError):
|
except (DistributionNotFound, ImportError):
|
||||||
print(f"{package} is not installed. Installing...")
|
print_verbose(f"{package} is not installed. Installing...")
|
||||||
subprocess.call([sys.executable, "-m", "pip", "install", package])
|
subprocess.call([sys.executable, "-m", "pip", "install", package])
|
||||||
globals()[package] = importlib.import_module(package)
|
globals()[package] = importlib.import_module(package)
|
||||||
except VersionConflict as vc:
|
except VersionConflict as vc:
|
||||||
print(f"Detected version conflict for {package}. Upgrading...")
|
print_verbose(f"Detected version conflict for {package}. Upgrading...")
|
||||||
subprocess.call([sys.executable, "-m", "pip", "install", "--upgrade", package])
|
subprocess.call([sys.executable, "-m", "pip", "install", "--upgrade", package])
|
||||||
globals()[package] = importlib.import_module(package)
|
globals()[package] = importlib.import_module(package)
|
||||||
finally:
|
finally:
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "litellm"
|
name = "litellm"
|
||||||
version = "0.1.371"
|
version = "0.1.372"
|
||||||
description = "Library to easily interface with LLM API providers"
|
description = "Library to easily interface with LLM API providers"
|
||||||
authors = ["BerriAI"]
|
authors = ["BerriAI"]
|
||||||
license = "MIT License"
|
license = "MIT License"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue