mirror of
https://github.com/MLSysBook/TinyTorch.git
synced 2026-07-16 19:02:01 -05:00
- Add suppress_output() helper in base.py (for reference) - Comment out debug print in virtual_env_manager.py - Remove noisy 'running this from' messages
23 lines
642 B
Python
23 lines
642 B
Python
import os, json
|
|
from pathlib import Path
|
|
|
|
DEFAULT_VENV = ".venv"
|
|
CONFIG_FILE = ".tinyrc"
|
|
|
|
|
|
def get_venv_path() -> Path:
|
|
"""
|
|
Fetch venv in case users have a custom path
|
|
"""
|
|
# print(f"running this from {os.getcwd()}") # Debug output - commented out for clean CLI
|
|
if "VENV_PATH" in os.environ:
|
|
return Path(os.environ["VENV_PATH"]).expanduser().resolve()
|
|
|
|
if Path(CONFIG_FILE).exists():
|
|
try:
|
|
cfg = json.load(open(CONFIG_FILE))
|
|
return Path(cfg.get("venv_path", DEFAULT_VENV)).expanduser().resolve()
|
|
except Exception:
|
|
pass
|
|
|
|
return Path(DEFAULT_VENV).resolve() |