Skip to content

Commit d94d033

Browse files
authored
Merge pull request #1828 from transformerlab/fix/lab-server-install-dir
Dont allow running lab server install from tlab src folder
2 parents 6bb8754 + 87cbff6 commit d94d033

3 files changed

Lines changed: 13 additions & 2 deletions

File tree

cli/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "transformerlab-cli"
7-
version = "0.0.14"
7+
version = "0.0.15"
88
description = "Transformer Lab CLI"
99
requires-python = ">=3.10"
1010
authors = [{ name = "Transformer Lab", email = "hello@transformerlab.ai" }]

cli/src/transformerlab_cli/commands/server.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,17 @@ def server_install(
580580
Use --dry-run to preview the configuration without writing.
581581
Use --config <path> to skip prompts and install from a pre-written .env file.
582582
"""
583+
src_dir = os.path.realpath(os.path.expanduser("~/.transformerlab/src"))
584+
cwd = os.path.realpath(os.getcwd())
585+
if cwd == src_dir or cwd.startswith(src_dir + os.sep):
586+
console.print(
587+
"\n[error]You are running this command from inside ~/.transformerlab/src, "
588+
"which is deleted during installation.[/error]\n"
589+
"Please change to a different directory and try again:\n\n"
590+
" cd ~ && lab server install\n"
591+
)
592+
raise typer.Exit(1)
593+
583594
if config:
584595
_install_from_config(config_path=config, dry_run=dry_run)
585596
else:

cli/uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)