@@ -69,52 +69,49 @@ jobs:
69
69
TORCH_URL_STABLE : " https://download.pytorch.org/whl/cpu/"
70
70
TORCH_URL_TEST : " https://download.pytorch.org/whl/test/cpu/"
71
71
FREEZE_REQUIREMENTS : ${{ ! (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release/')) }}
72
- PYPI_CACHE_DIR : " _pip-wheels"
73
72
# TODO: Remove this - Enable running MPS tests on this platform
74
73
DISABLE_MPS : ${{ matrix.os == 'macOS-14' && '1' || '0' }}
75
74
steps :
76
75
- uses : actions/checkout@v5
77
76
78
- - name : Set up Python ${{ matrix.config.python-version }}
79
- uses : actions /setup-python@v5
77
+ - name : Install uv and set Python version
78
+ uses : astral-sh /setup-uv@v6
80
79
with :
81
80
python-version : ${{ matrix.config.python-version || '3.9' }}
81
+ # TODO: Avoid activating environment like this
82
+ # see: https://github.com/astral-sh/setup-uv/tree/v6/?tab=readme-ov-file#activate-environment
83
+ activate-environment : true
84
+ enable-cache : true
82
85
83
- - name : basic setup
84
- run : pip install -q -r .actions/requirements.txt
86
+ - name : Basic setup
87
+ run : uv pip install -q -r .actions/requirements.txt
85
88
86
89
- name : Append Env. vars for Linux
87
90
if : ${{ runner.os == 'Linux' }}
88
91
run : echo "GLOO_SOCKET_IFNAME=eth0" >> $GITHUB_ENV
92
+ - name : Append Env. vars for MacOS
93
+ if : ${{ runner.os == 'macOS' }}
94
+ run : echo "GLOO_SOCKET_IFNAME=lo0" >> $GITHUB_ENV
89
95
90
96
- name : Set min. dependencies
91
97
if : ${{ matrix.config.requires == 'oldest' }}
92
98
run : |
93
99
cd requirements/pytorch
94
- pip install -U "lightning-utilities[cli]"
100
+ uv pip install -U "lightning-utilities[cli]"
95
101
python -m lightning_utilities.cli requirements set-oldest --req_files "['base.txt', 'extra.txt', 'strategies.txt', 'examples.txt', 'test.txt']"
96
- pip install "cython<3.0" wheel
97
- pip install "pyyaml==5.4" --no-build-isolation
102
+ uv pip install "cython<3.0" wheel
103
+ uv pip install "pyyaml==5.4" --no-build-isolation
98
104
99
105
- name : Adjust PyTorch versions in requirements files
100
106
if : ${{ matrix.config.requires != 'oldest' }}
101
107
run : |
102
- pip install -q -r requirements/ci.txt
108
+ uv pip install -q -r requirements/ci.txt
103
109
python -m wget https://raw.githubusercontent.com/Lightning-AI/utilities/main/scripts/adjust-torch-versions.py
104
110
for fpath in `ls requirements/**/*.txt`; do \
105
111
python ./adjust-torch-versions.py $fpath ${{ matrix.config.pytorch-version }}; \
106
112
done
107
113
cat requirements/pytorch/base.txt
108
114
109
- - name : pip wheels cache
110
- uses : actions/cache/restore@v4
111
- with :
112
- path : ${{ env.PYPI_CACHE_DIR }}
113
- key : pypi_wheels
114
- - run : |
115
- mkdir -p $PYPI_CACHE_DIR
116
- ls -lh $PYPI_CACHE_DIR
117
-
118
115
- name : Env. variables
119
116
run : |
120
117
# Switch PyTorch URL between stable and test/future
@@ -129,19 +126,21 @@ jobs:
129
126
- name : Install package & dependencies
130
127
timeout-minutes : 20
131
128
run : |
132
- pip install ".[${EXTRA_PREFIX}extra,${EXTRA_PREFIX}test,${EXTRA_PREFIX}strategies]" \
133
- -U -- upgrade-strategy=eager --prefer-binary \
129
+ uv pip install ".[${EXTRA_PREFIX}extra,${EXTRA_PREFIX}test,${EXTRA_PREFIX}strategies]" \
130
+ -- upgrade \
134
131
-r requirements/_integrations/accelerators.txt \
135
- --extra-index-url ="${TORCH_URL}" \
136
- --find-links="${PYPI_CACHE_DIR}"
137
- pip list
132
+ --find-links ="${TORCH_URL}"
133
+ uv pip list
134
+
138
135
- name : Drop LAI from extensions
139
136
if : ${{ matrix.config.pkg-name != 'lightning' }}
140
137
# Lightning is dependency of Habana or other accelerators/integrations so in case we test PL we need to remove it
141
- run : pip uninstall -y lightning
138
+ run : uv pip uninstall lightning
139
+
142
140
- name : Drop PL for LAI
143
141
if : ${{ matrix.config.pkg-name == 'lightning' }}
144
- run : pip uninstall -y pytorch-lightning
142
+ run : uv pip uninstall pytorch-lightning
143
+
145
144
- name : Dump handy wheels
146
145
if : github.event_name == 'push' && github.ref == 'refs/heads/master'
147
146
continue-on-error : true
@@ -218,6 +217,9 @@ jobs:
218
217
name : CPU-coverage
219
218
fail_ci_if_error : false
220
219
220
+ - name : Minimize uv cache
221
+ run : uv cache prune --ci
222
+
221
223
pl-cpu-guardian :
222
224
runs-on : ubuntu-latest
223
225
needs : pl-cpu
0 commit comments