.envrc config for custom uv project venv and cache
When working on turing/ada, it is useful to install
python packages on the /scratch directory
instead of .venv.
Fortunately, the blessed people at uv have a specific command for this.
# .envrc
export UV_PROJECT_ENVIRONMENT=/scratch/venvs/myproj
export UV_CACHE_DIR=/scratch/uv_cache
Add it to direnv and then run direnv allow to approve.
Test using:
uv add tqdm pip # only to be able to >pip show< on >uv run<
uv run python3 -m pip show tqdm
will return something like
...
Location: /scratch/venvs/bitter_lesson/lib/python3.12/site-packages
...
Now the heavy packages can live on cheap compute node storage instead of the master node.