|
23 | 23 | from pathlib import Path |
24 | 24 | from typing import List, Optional |
25 | 25 |
|
| 26 | +from platformdirs import user_cache_dir |
| 27 | + |
| 28 | + |
| 29 | +PIP_CACHE_DIR = user_cache_dir(appname="bionemo-pip-cache", appauthor="nvidia") |
26 | 30 |
|
27 | 31 | logger = logging.getLogger(__name__) |
28 | 32 | logger.setLevel(logging.DEBUG) |
|
36 | 40 | "memlock=-1", |
37 | 41 | "--ulimit", |
38 | 42 | "stack=67108864", |
| 43 | + "-v", |
| 44 | + f"{PIP_CACHE_DIR}:/workspace/.cache/pip", |
39 | 45 | ] |
40 | 46 |
|
41 | 47 | CUSTOM_CONTAINERS = { |
42 | 48 | "models/amplify": "svcbionemo023/bionemo-framework:amplify-model-devcontainer-082025", |
43 | 49 | } |
44 | | -DEFAULT_CONTAINER = "nvcr.io/nvidia/pytorch:25.06-py3" |
| 50 | +# DEFAULT_CONTAINER = "nvcr.io/nvidia/pytorch:25.06-py3" |
| 51 | +DEFAULT_CONTAINER = "nvcr.io/nvidian/cvai_bnmo_trng/bionemo:pytorch25.06-py3-squashed" |
45 | 52 |
|
46 | 53 |
|
47 | 54 | def get_git_root() -> str: |
@@ -89,23 +96,22 @@ def run_tests_in_docker(work_dir: str) -> bool: |
89 | 96 | set -e # Exit on any error |
90 | 97 |
|
91 | 98 | echo "Checking for dependency files..." |
92 | | -
|
93 | 99 | # Install dependencies based on available files |
94 | 100 | if [ -f pyproject.toml ] || [ -f setup.py ]; then |
95 | 101 | echo "Installing package in editable mode..." |
96 | | - PIP_CONSTRAINT= pip install -e . |
| 102 | + PIP_CACHE_DIR=/workspace/.cache/pip PIP_CONSTRAINT= pip install -e . |
97 | 103 | echo "Installed package as editable package" |
98 | 104 | elif [ -f requirements.txt ]; then |
99 | 105 | echo "Installing from requirements.txt..." |
100 | | - PIP_CONSTRAINT= pip install -r requirements.txt |
| 106 | + PIP_CACHE_DIR=/workspace/.cache/pip PIP_CONSTRAINT= pip install -r requirements.txt |
101 | 107 | echo "Installed from requirements.txt" |
102 | 108 | else |
103 | 109 | echo "No pyproject.toml, setup.py, or requirements.txt found" |
104 | 110 | exit 1 |
105 | 111 | fi |
106 | 112 |
|
107 | 113 | echo "Running tests..." |
108 | | - pytest -v . |
| 114 | + python -m pytest -v . |
109 | 115 | """) |
110 | 116 |
|
111 | 117 | relative_path = Path(work_dir).relative_to(git_root).as_posix() |
@@ -165,6 +171,8 @@ def main(): |
165 | 171 | if args.debug: |
166 | 172 | logging.getLogger().setLevel(logging.DEBUG) |
167 | 173 |
|
| 174 | + logger.info(f"Caching pip installations to: {PIP_CACHE_DIR}") |
| 175 | + |
168 | 176 | # Get directories to test |
169 | 177 | test_dirs = get_test_directories(args.directories) |
170 | 178 |
|
|
0 commit comments