@@ -69,52 +69,49 @@ jobs:
6969 TORCH_URL_STABLE : " https://download.pytorch.org/whl/cpu/"
7070 TORCH_URL_TEST : " https://download.pytorch.org/whl/test/cpu/"
7171 FREEZE_REQUIREMENTS : ${{ ! (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release/')) }}
72- PYPI_CACHE_DIR : " _pip-wheels"
7372 # TODO: Remove this - Enable running MPS tests on this platform
7473 DISABLE_MPS : ${{ matrix.os == 'macOS-14' && '1' || '0' }}
7574 steps :
7675 - uses : actions/checkout@v5
7776
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
8079 with :
8180 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
8285
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
8588
8689 - name : Append Env. vars for Linux
8790 if : ${{ runner.os == 'Linux' }}
8891 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
8995
9096 - name : Set min. dependencies
9197 if : ${{ matrix.config.requires == 'oldest' }}
9298 run : |
9399 cd requirements/pytorch
94- pip install -U "lightning-utilities[cli]"
100+ uv pip install -U "lightning-utilities[cli]"
95101 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
98104
99105 - name : Adjust PyTorch versions in requirements files
100106 if : ${{ matrix.config.requires != 'oldest' }}
101107 run : |
102- pip install -q -r requirements/ci.txt
108+ uv pip install -q -r requirements/ci.txt
103109 python -m wget https://raw.githubusercontent.com/Lightning-AI/utilities/main/scripts/adjust-torch-versions.py
104110 for fpath in `ls requirements/**/*.txt`; do \
105111 python ./adjust-torch-versions.py $fpath ${{ matrix.config.pytorch-version }}; \
106112 done
107113 cat requirements/pytorch/base.txt
108114
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-
118115 - name : Env. variables
119116 run : |
120117 # Switch PyTorch URL between stable and test/future
@@ -129,19 +126,21 @@ jobs:
129126 - name : Install package & dependencies
130127 timeout-minutes : 20
131128 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 \
134131 -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+
138135 - name : Drop LAI from extensions
139136 if : ${{ matrix.config.pkg-name != 'lightning' }}
140137 # 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+
142140 - name : Drop PL for LAI
143141 if : ${{ matrix.config.pkg-name == 'lightning' }}
144- run : pip uninstall -y pytorch-lightning
142+ run : uv pip uninstall pytorch-lightning
143+
145144 - name : Dump handy wheels
146145 if : github.event_name == 'push' && github.ref == 'refs/heads/master'
147146 continue-on-error : true
@@ -218,6 +217,9 @@ jobs:
218217 name : CPU-coverage
219218 fail_ci_if_error : false
220219
220+ - name : Minimize uv cache
221+ run : uv cache prune --ci
222+
221223 pl-cpu-guardian :
222224 runs-on : ubuntu-latest
223225 needs : pl-cpu
0 commit comments