mirror of
https://github.com/Hopiu/llm.git
synced 2026-03-17 05:00:25 +00:00
llm install -e/--editable option
This commit is contained in:
parent
78c93b9e23
commit
f193468f76
2 changed files with 14 additions and 5 deletions
|
|
@ -263,13 +263,14 @@ Options:
|
|||
```
|
||||
### llm install --help
|
||||
```
|
||||
Usage: llm install [OPTIONS] PACKAGES...
|
||||
Usage: llm install [OPTIONS] [PACKAGES]...
|
||||
|
||||
Install packages from PyPI into the same environment as LLM
|
||||
|
||||
Options:
|
||||
-U, --upgrade Upgrade packages to latest version
|
||||
--help Show this message and exit.
|
||||
-U, --upgrade Upgrade packages to latest version
|
||||
-e, --editable DIRECTORY Install a project in editable mode from this path
|
||||
--help Show this message and exit.
|
||||
```
|
||||
### llm uninstall --help
|
||||
```
|
||||
|
|
|
|||
12
llm/cli.py
12
llm/cli.py
|
|
@ -492,15 +492,23 @@ def templates_path():
|
|||
|
||||
|
||||
@cli.command()
|
||||
@click.argument("packages", nargs=-1, required=True)
|
||||
@click.argument("packages", nargs=-1, required=False)
|
||||
@click.option(
|
||||
"-U", "--upgrade", is_flag=True, help="Upgrade packages to latest version"
|
||||
)
|
||||
def install(packages, upgrade):
|
||||
@click.option(
|
||||
"-e",
|
||||
"--editable",
|
||||
type=click.Path(readable=True, exists=True, dir_okay=True, file_okay=False),
|
||||
help="Install a project in editable mode from this path",
|
||||
)
|
||||
def install(packages, upgrade, editable):
|
||||
"""Install packages from PyPI into the same environment as LLM"""
|
||||
args = ["pip", "install"]
|
||||
if upgrade:
|
||||
args += ["--upgrade"]
|
||||
if editable:
|
||||
args += ["--editable", str(editable)]
|
||||
args += list(packages)
|
||||
sys.argv = args
|
||||
run_module("pip", run_name="__main__")
|
||||
|
|
|
|||
Loading…
Reference in a new issue