Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions agentstack/packaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# When calling `uv` we explicitly specify the --python executable to use so that
# the packages are installed into the correct virtual environment.
# In testing, when this was not set, packages could end up in the pyenv's
# site-packages directory; it's possible an environemnt variable can control this.
# site-packages directory; it's possible an environment variable can control this.


def install(package: str):
Expand All @@ -31,6 +31,7 @@
def on_error(line: str):
log.error(f"uv: [error]\n {line.strip()}")

log.info(f"Installing {package}")
_wrap_command_with_callbacks(
[get_uv_bin(), 'add', '--python', '.venv/bin/python', package],
on_progress=on_progress,
Expand Down Expand Up @@ -79,6 +80,7 @@
def on_error(line: str):
log.error(f"uv: [error]\n {line.strip()}")

log.info(f"Uninstalling {requirement.name}")
_wrap_command_with_callbacks(
[get_uv_bin(), 'remove', '--python', '.venv/bin/python', requirement.name],
on_progress=on_progress,
Expand All @@ -97,6 +99,7 @@
def on_error(line: str):
log.error(f"uv: [error]\n {line.strip()}")

log.info(f"Upgrading {package}")

Check warning on line 102 in agentstack/packaging.py

View check run for this annotation

Codecov / codecov/patch

agentstack/packaging.py#L102

Added line #L102 was not covered by tests
_wrap_command_with_callbacks(
[get_uv_bin(), 'pip', 'install', '-U', '--python', '.venv/bin/python', package],
on_progress=on_progress,
Expand All @@ -105,7 +108,7 @@


def create_venv(python_version: str = DEFAULT_PYTHON_VERSION):
"""Intialize a virtual environment in the project directory of one does not exist."""
"""Initialize a virtual environment in the project directory of one does not exist."""
if os.path.exists(conf.PATH / VENV_DIR_NAME):
return # venv already exists

Expand Down