Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Make package installation in CI fast with uv #19556

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .github/workflows/ci-tests-fabric.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ jobs:
python-version: ${{ matrix.python-version }}

- name: basic setup
run: pip install -q -r .actions/requirements.txt
run: |
pip install uv
uv pip install -q -r .actions/requirements.txt --system

- name: Set min. dependencies
if: ${{ matrix.requires == 'oldest' }}
Expand All @@ -107,7 +109,7 @@ jobs:
- name: Adjust PyTorch versions in requirements files
if: ${{ matrix.requires != 'oldest' }}
run: |
pip install -q -r requirements/ci.txt
uv pip install -q -r requirements/ci.txt --system
python -m wget https://raw.githubusercontent.com/Lightning-AI/utilities/main/scripts/adjust-torch-versions.py
for fpath in `ls requirements/**/*.txt`; do \
python ./adjust-torch-versions.py $fpath ${{ matrix.pytorch-version }}; \
Expand All @@ -134,9 +136,9 @@ jobs:
- name: Install package & dependencies
timeout-minutes: 20
run: |
pip install -e ".[${EXTRA_PREFIX}test,${EXTRA_PREFIX}strategies]" -U --prefer-binary \
uv pip install -e ".[${EXTRA_PREFIX}test,${EXTRA_PREFIX}strategies]" -U --system \
--find-links="${TORCH_URL}" --find-links="${PYPI_CACHE_DIR}"
pip list
uv pip list --system
- name: Dump handy wheels
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
continue-on-error: true
Expand Down
26 changes: 14 additions & 12 deletions .github/workflows/ci-tests-pytorch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ jobs:
python-version: ${{ matrix.python-version }}

- name: basic setup
run: pip install -q -r .actions/requirements.txt
run: |
pip install uv
uv pip install -q -r .actions/requirements.txt --system

- name: Set min. dependencies
if: ${{ matrix.requires == 'oldest' }}
Expand All @@ -112,7 +114,7 @@ jobs:
- name: Adjust PyTorch versions in requirements files
if: ${{ matrix.requires != 'oldest' }}
run: |
pip install -q -r requirements/ci.txt
uv pip install -q -r requirements/ci.txt --system
python -m wget https://raw.githubusercontent.com/Lightning-AI/utilities/main/scripts/adjust-torch-versions.py
for fpath in `ls requirements/**/*.txt`; do \
python ./adjust-torch-versions.py $fpath ${{ matrix.pytorch-version }}; \
Expand Down Expand Up @@ -140,17 +142,17 @@ jobs:
- name: Install package & dependencies
timeout-minutes: 20
run: |
pip install ".[${EXTRA_PREFIX}extra,${EXTRA_PREFIX}test,${EXTRA_PREFIX}strategies]" -U --prefer-binary \
uv pip install -e ".[${EXTRA_PREFIX}extra,${EXTRA_PREFIX}test,${EXTRA_PREFIX}strategies]" -U --system \
-r requirements/_integrations/accelerators.txt \
--find-links="${TORCH_URL}" --find-links="${PYPI_CACHE_DIR}"
pip list
uv pip list --system
- name: Drop LAI from extensions
if: ${{ matrix.pkg-name != 'lightning' }}
# Lightning is dependency of Habana or other accelerators/integrations so in case we test PL we need to remove it
run: pip uninstall -y lightning
run: uv pip uninstall lightning --system
- name: Drop PL for LAI
if: ${{ matrix.pkg-name == 'lightning' }}
run: pip uninstall -y pytorch-lightning
run: uv pip uninstall pytorch-lightning --system
- name: Dump handy wheels
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
continue-on-error: true
Expand Down Expand Up @@ -182,12 +184,12 @@ jobs:
- name: Prevent using raw source
run: rm -rf src/

- name: Get legacy checkpoints
run: |
bash .actions/pull_legacy_checkpoints.sh
cd tests/legacy
bash generate_checkpoints.sh
ls -l checkpoints/
# - name: Get legacy checkpoints
# run: |
# bash .actions/pull_legacy_checkpoints.sh
# cd tests/legacy
# bash generate_checkpoints.sh
# ls -l checkpoints/

- name: Testing Warnings
working-directory: tests/tests_pytorch
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/docs-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,10 @@ jobs:

- name: Pull sphinx template
run: |
pip install -q -r requirements/ci.txt
pip install uv
uv pip install -q -r requirements/ci.txt --system
aws s3 sync --no-sign-request s3://sphinx-packages/ ${PYPI_LOCAL_DIR}
pip install lai-sphinx-theme -U -f ${PYPI_LOCAL_DIR}
uv pip install lai-sphinx-theme -U -f ${PYPI_LOCAL_DIR} --system

- name: pip wheels cache
uses: actions/cache/restore@v4
Expand All @@ -96,13 +97,13 @@ jobs:
run: |
mkdir -p ${PYPI_CACHE_DIR} # in case cache was not hit
ls -lh ${PYPI_CACHE_DIR}
pip install .[all] -U -r requirements/${{ matrix.pkg-name }}/docs.txt \
uv pip install "lightning[dev] @ ." -U -r requirements/${{ matrix.pkg-name }}/docs.txt --system \
-f ${PYPI_LOCAL_DIR} -f ${PYPI_CACHE_DIR} -f ${TORCH_URL}
pip list
uv pip list --system
- name: Install req. for Notebooks/tutorials
if: matrix.pkg-name == 'pytorch'
timeout-minutes: 10
run: pip install -q -r _notebooks/.actions/requires.txt
run: uv pip install -q -r _notebooks/.actions/requires.txt --system

- name: Full build for deployment
if: github.event_name != 'pull_request'
Expand Down
4 changes: 2 additions & 2 deletions requirements/pytorch/docs.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-r ../docs.txt

nbformat # used for generate empty notebook
ipython[notebook] <8.7.0
setuptools<58.0 # workaround for `error in ipython setup command: use_2to3 is invalid.`
ipython[notebook]
setuptools<70.0

-r ../../_notebooks/.actions/requires.txt
Loading