Skip to content

Commit e3e28f3

Browse files
committed
Install packages with pip
1 parent f9c8c6f commit e3e28f3

4 files changed

Lines changed: 6 additions & 33 deletions

File tree

aipyapp/aipy/runner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def install_packages(self, packages):
116116
return True
117117
ok = utils.confirm(self._console, f"💬 {T('agree_packages')} 'y'> ", auto=self._auto_install)
118118
if ok:
119-
return utils.uv_install_packages(self._console, need_install)
119+
return utils.install_packages(self._console, need_install)
120120

121121
@utils.restore_output
122122
def getenv(self, name, desc=None):

aipyapp/aipy/utils.py

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33

4-
import os
54
import sys
65
import subprocess
76
from functools import wraps
@@ -32,33 +31,7 @@ def confirm(console, prompt, default="n", auto=None):
3231
break
3332
return response == "y"
3433

35-
def get_uv_from_venv():
36-
venv_path = os.getenv("VIRTUAL_ENV")
37-
if not venv_path:
38-
print("VIRTUAL_ENV is not set.")
39-
return None
40-
41-
cfg_path = os.path.join(venv_path, "pyvenv.cfg")
42-
if not os.path.exists(cfg_path):
43-
print(f"pyvenv.cfg not found in {venv_path}")
44-
return None
45-
46-
uv_value = None
47-
with open(cfg_path, "r", encoding="utf-8") as f:
48-
for line in f:
49-
line = line.strip()
50-
if line.startswith("uv ="):
51-
_, uv_value = map(str.strip, line.split("=", 1))
52-
break
53-
54-
return uv_value
55-
56-
def uv_install_packages(console, packages):
57-
uvv = get_uv_from_venv()
58-
if not uvv:
59-
console.print("[red]Not in uv venv, can't install packages")
60-
return False
61-
62-
console.print(f"[green]Install packages: {', '.join(packages)} with uv {uvv}")
63-
cp = subprocess.run(['uv', "add"] + packages)
34+
def install_packages(console, packages):
35+
console.print(f"[green]Install packages: {', '.join(packages)} with pip")
36+
cp = subprocess.run([sys.executable, "-m", "pip", "install"] + packages)
6437
return cp.returncode == 0

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "aipyapp"
3-
version = "0.1.12"
3+
version = "0.1.13"
44
description = "AIPyApp: AI-Powered Python & Python-Powered AI"
55
readme = "README.md"
66
requires-python = ">=3.9"

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)