24 lines
525 B
Plaintext
24 lines
525 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
|
|
|
|
|
|
def _setup_python_direnv():
|
|
echo "layout python3" >> .envrc
|
|
direnv allow
|
|
|
|
|
|
aliases["vv"] = _vv
|
|
aliases["penv"] = _setup_python_direnv
|