@@ -69,48 +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
88
+
89
+ - name : Append Env. vars for Linux
90
+ if : ${{ runner.os == 'Linux' }}
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
85
95
86
96
- name : Set min. dependencies
87
- if : ${{ matrix.requires == 'oldest' }}
97
+ if : ${{ matrix.config. requires == 'oldest' }}
88
98
run : |
89
99
cd requirements/pytorch
90
- pip install -U "lightning-utilities[cli]"
100
+ uv pip install -U "lightning-utilities[cli]"
91
101
python -m lightning_utilities.cli requirements set-oldest --req_files "['base.txt', 'extra.txt', 'strategies.txt', 'examples.txt', 'test.txt']"
92
- pip install "cython<3.0" wheel
93
- 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
94
104
95
105
- name : Adjust PyTorch versions in requirements files
96
- if : ${{ matrix.requires != 'oldest' }}
106
+ if : ${{ matrix.config. requires != 'oldest' }}
97
107
run : |
98
- pip install -q -r requirements/ci.txt
108
+ uv pip install -q -r requirements/ci.txt
99
109
python -m wget https://raw.githubusercontent.com/Lightning-AI/utilities/main/scripts/adjust-torch-versions.py
100
110
for fpath in `ls requirements/**/*.txt`; do \
101
111
python ./adjust-torch-versions.py $fpath ${{ matrix.config.pytorch-version }}; \
102
112
done
103
113
cat requirements/pytorch/base.txt
104
114
105
- - name : pip wheels cache
106
- uses : actions/cache/restore@v4
107
- with :
108
- path : ${{ env.PYPI_CACHE_DIR }}
109
- key : pypi_wheels
110
- - run : |
111
- mkdir -p $PYPI_CACHE_DIR
112
- ls -lh $PYPI_CACHE_DIR
113
-
114
115
- name : Env. variables
115
116
run : |
116
117
# Switch PyTorch URL between stable and test/future
@@ -125,20 +126,22 @@ jobs:
125
126
- name : Install package & dependencies
126
127
timeout-minutes : 20
127
128
run : |
128
- pip install ".[${EXTRA_PREFIX}extra,${EXTRA_PREFIX}test,${EXTRA_PREFIX}strategies]" \
129
- -U -- upgrade-strategy=eager --prefer-binary \
129
+ uv pip install ".[${EXTRA_PREFIX}extra,${EXTRA_PREFIX}test,${EXTRA_PREFIX}strategies]" \
130
+ -- upgrade \
130
131
-r requirements/_integrations/accelerators.txt \
131
- --extra-index-url="${TORCH_URL}" \
132
- --find-links="${PYPI_CACHE_DIR}" \
132
+ --find-links="${TORCH_URL}" \
133
133
--find-links="https://download.pytorch.org/whl/torch-tensorrt"
134
- pip list
134
+ uv pip list
135
+
135
136
- name : Drop LAI from extensions
136
137
if : ${{ matrix.config.pkg-name != 'lightning' }}
137
138
# Lightning is dependency of Habana or other accelerators/integrations so in case we test PL we need to remove it
138
- run : pip uninstall -y lightning
139
+ run : uv pip uninstall lightning
140
+
139
141
- name : Drop PL for LAI
140
142
if : ${{ matrix.config.pkg-name == 'lightning' }}
141
- run : pip uninstall -y pytorch-lightning
143
+ run : uv pip uninstall pytorch-lightning
144
+
142
145
- name : Dump handy wheels
143
146
if : github.event_name == 'push' && github.ref == 'refs/heads/master'
144
147
continue-on-error : true
@@ -215,6 +218,9 @@ jobs:
215
218
name : CPU-coverage
216
219
fail_ci_if_error : false
217
220
221
+ - name : Minimize uv cache
222
+ run : uv cache prune --ci
223
+
218
224
pl-cpu-guardian :
219
225
runs-on : ubuntu-latest
220
226
needs : pl-cpu
0 commit comments