Files
dotfiles/xonsh/python.xsh
2022-01-06 16:50:56 -08:00

18 lines
403 B
Plaintext

def _vv():
"""Finds the nearest venv going upward in the directory hierarchy and activates it."""
d = Path.cwd()
while True:
if (d / "venv").exists():
vox activate @(str(d / "venv"))
return True
if d == d.parent or (d / ".git").exists():
print("Could not find venv.")
return False
d = d.parent
aliases["vv"] = _vv