llm install --pre option, closes #1060

This commit is contained in:
Simon Willison 2025-05-20 18:24:48 -07:00
parent f879b816e4
commit a3414ed15d
2 changed files with 9 additions and 1 deletions

View file

@ -829,6 +829,7 @@ Options:
--force-reinstall Reinstall all packages even if they are already up-to-
date
--no-cache-dir Disable the cache
--pre Include pre-release and development versions
--help Show this message and exit.
```

View file

@ -2657,7 +2657,12 @@ def display_truncated(text):
is_flag=True,
help="Disable the cache",
)
def install(packages, upgrade, editable, force_reinstall, no_cache_dir):
@click.option(
"--pre",
is_flag=True,
help="Include pre-release and development versions",
)
def install(packages, upgrade, editable, force_reinstall, no_cache_dir, pre):
"""Install packages from PyPI into the same environment as LLM"""
args = ["pip", "install"]
if upgrade:
@ -2668,6 +2673,8 @@ def install(packages, upgrade, editable, force_reinstall, no_cache_dir):
args += ["--force-reinstall"]
if no_cache_dir:
args += ["--no-cache-dir"]
if pre:
args += ["--pre"]
args += list(packages)
sys.argv = args
run_module("pip", run_name="__main__")