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

Use uv to speed up pip installs & the CI in general #2442

Merged
merged 86 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
97def7b
Use uv
strickvl Feb 15, 2024
0be43eb
add to migration testing
strickvl Feb 15, 2024
340ad1b
typo fix
strickvl Feb 15, 2024
11746ce
fixes
strickvl Feb 15, 2024
c722dbe
api checks
strickvl Feb 15, 2024
e25abb4
remove -U
strickvl Feb 15, 2024
2c74e4f
test dargli
strickvl Feb 15, 2024
ba7fde8
source
strickvl Feb 15, 2024
781718a
activate
strickvl Feb 15, 2024
d7d8a72
as property
strickvl Feb 15, 2024
26d0e5a
sourced
strickvl Feb 15, 2024
25fbfc2
try fix
strickvl Feb 16, 2024
271b311
remove cache
strickvl Feb 16, 2024
ae2b11b
try export
strickvl Feb 16, 2024
6cc351d
source
strickvl Feb 16, 2024
8aaf5fd
new approach
strickvl Feb 16, 2024
4d40b69
refactor
strickvl Feb 16, 2024
7f63c66
refactor2
strickvl Feb 16, 2024
9a89404
setup env
strickvl Feb 16, 2024
7e4c835
fast ci
strickvl Feb 16, 2024
b55f563
environment installation
strickvl Feb 16, 2024
4ff6df1
remove pip upgrade
strickvl Feb 16, 2024
afb726f
remove pip completely
strickvl Feb 16, 2024
3c84c11
Merge remote-tracking branch 'origin/develop' into feature/use-uv-ci
strickvl Feb 19, 2024
5f5a4d6
try different configuration
strickvl Feb 19, 2024
9c4cbf3
Merge remote-tracking branch 'origin/develop' into feature/use-uv-ci
strickvl Feb 28, 2024
b649372
uv refactor
strickvl Feb 29, 2024
bb9fc91
Merge remote-tracking branch 'origin/develop' into feature/use-uv-ci
strickvl Feb 29, 2024
cd469f3
Update virtual environment setup and dependencies
strickvl Feb 29, 2024
09e3210
line extra
strickvl Feb 29, 2024
5058041
use uv instead of pip
strickvl Feb 29, 2024
b7e5a73
Remove unnecessary environment variable assignment
strickvl Feb 29, 2024
103ad61
Add source command to setup environment scripts
strickvl Feb 29, 2024
d69d6b6
remove pip install
strickvl Feb 29, 2024
c33d0d2
remove old venv setup
strickvl Feb 29, 2024
55485b7
Merge branch 'develop' into feature/use-uv-ci
strickvl Feb 29, 2024
ffb636e
typo
strickvl Feb 29, 2024
bbe93ac
add pip back (partially)
strickvl Feb 29, 2024
f6fc38b
Update sklearn integration installation in test-migrations scripts
strickvl Feb 29, 2024
9c5f5db
Merge branch 'develop' into feature/use-uv-ci
strickvl Feb 29, 2024
b81b6de
Auto-update of Starter template
actions-user Feb 29, 2024
9801dd4
Auto-update of NLP template
actions-user Feb 29, 2024
943ed1b
Merge branch 'feature/use-uv-ci' of github.com:zenml-io/zenml into fe…
strickvl Mar 1, 2024
1f79ba6
uv pip list instead of plain pip
strickvl Mar 1, 2024
e31fa08
Merge remote-tracking branch 'origin/develop' into feature/use-uv-ci
strickvl Mar 1, 2024
a62b37c
Fix source type resolution for defaultdict on Windows
strickvl Mar 1, 2024
86cf5c8
partially disable CI
strickvl Mar 1, 2024
94b219c
formatting
strickvl Mar 1, 2024
3439404
Merge branch 'develop' into feature/use-uv-ci
strickvl Mar 1, 2024
23d82d1
formatting
strickvl Mar 1, 2024
1b470c8
update second test for windows
strickvl Mar 1, 2024
d2c79fc
run the whole ci again
strickvl Mar 1, 2024
28eb2f5
Merge branch 'develop' into feature/use-uv-ci
strickvl Mar 5, 2024
6ae7486
Merge remote-tracking branch 'origin/develop' into feature/use-uv-ci
strickvl Mar 7, 2024
1a9ea7b
revert test changes
strickvl Mar 7, 2024
1931fbe
remove old venv commands
strickvl Mar 7, 2024
56c50b9
debug uv failure
strickvl Mar 7, 2024
7e28486
add bash shell for windows
strickvl Mar 7, 2024
e5b2908
install zenml
strickvl Mar 7, 2024
35ba2bb
fix editable install
strickvl Mar 7, 2024
fc342d1
add newline
strickvl Mar 7, 2024
eeb5301
remove double uv for pip debug logging
strickvl Mar 7, 2024
6025ce7
disable CI temporarily for testing
strickvl Mar 7, 2024
9eb0c8c
yamlfix
strickvl Mar 7, 2024
cb9739f
unfail
strickvl Mar 7, 2024
45a66f1
more metadata about collections
strickvl Mar 7, 2024
27e3f2f
faster resolution for test
strickvl Mar 7, 2024
046fa1e
fix escape
strickvl Mar 7, 2024
854cf48
attempt fix for windows source resolution
strickvl Mar 7, 2024
76b0d2d
format and windows unit tests
strickvl Mar 7, 2024
4aa73a5
add ubuntu unit tests
strickvl Mar 7, 2024
df83964
Merge branch 'develop' into feature/use-uv-ci
strickvl Mar 7, 2024
095707d
revert source_utils changes
strickvl Mar 7, 2024
1b80e4c
try adding cache back in
strickvl Mar 7, 2024
6b35e94
restore normal CI
strickvl Mar 7, 2024
af09d9f
add spellcheck back
strickvl Mar 7, 2024
9e542e1
delete test workflow
strickvl Mar 7, 2024
4b982c2
Merge branch 'develop' into feature/use-uv-ci
strickvl Mar 8, 2024
53e1fdf
use int instead + disable cache again
strickvl Mar 8, 2024
00c39ff
Auto-update of Starter template
actions-user Mar 8, 2024
b5e45ac
remove file attrib check
strickvl Mar 8, 2024
14ee42b
Merge branch 'feature/use-uv-ci' of github.com:zenml-io/zenml into fe…
strickvl Mar 8, 2024
996dd80
increase HTTP timeout for uv (for torch)
strickvl Mar 8, 2024
22ee139
update for new migration script
strickvl Mar 8, 2024
040af97
test to ensure that the uv updates work now
strickvl Mar 8, 2024
87bb126
no need to run mariadb on fastCI
strickvl Mar 8, 2024
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
102 changes: 50 additions & 52 deletions .github/actions/setup_environment/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,12 @@ inputs:
required: true
python-version:
description: Python version
type: string
required: true
os:
description: OS
type: string
required: true
install_integrations:
description: Install ZenML integrations
type: string
required: false
default: 'yes'
runners_cache_access_key_id:
Expand Down Expand Up @@ -56,56 +53,57 @@ runs:
shell: bash
run: |
"C:\Program Files\Git\bin\git.exe" config --global user.email "info@zenml.io"
"C:\Program Files\Git\bin\git.exe" config --global user.name "ZenML GmbH"
- name: Get current week
shell: bash
id: date
run: echo "::set-output name=week::$(date +'calendar-week-%W')"
- uses: syphar/restore-virtualenv@v1
if: ${{ inputs.os != 'arc-runner-set' }}
id: cache-virtualenv
with:
requirement_files: pyproject.toml
# The virtualenv cache is invalidated when:
# - manually triggered by means of a custom cache version token
# - on a weekly basis
# - any of the integration requirements change (a hash of the
# __init__.py files is included in the cache key)
custom_cache_key_element: ${{ inputs.cache_version }}-${{steps.date.outputs.week}}-${{inputs.install_integrations}}-${{
hashFiles('src/zenml/integrations/*/__init__.py') }}
- uses: tespkg/actions-cache@v1
if: ${{ inputs.os == 'arc-runner-set' }}
id: custom-cache-pip
env:
AWS_ACCESS_KEY_ID: ${{ inputs.runners_cache_access_key_id }}
AWS_SECRET_ACCESS_KEY: ${{ inputs.runners_cache_secret_access_key }}
with:
endpoint: minio-service.minio.svc.cluster.local # optional
insecure: true # optional, use http instead of https. default false
bucket: caching # required
use-fallback: false # optional, use github actions cache fallback, default false
key: ${{ inputs.os }}-${{ inputs.cache_version }}-${{ inputs.python-version
}}-${{inputs.install_integrations}}
path: |
~/.cache/pip
restore-keys: |
${{ inputs.os }}-${{ inputs.cache_version }}-${{ inputs.python-version }}-${{inputs.install_integrations}}
- name: Custom runners cache miss
uses: rjstone/discord-webhook-notify@v1
if: steps.custom-cache-pip.outputs.cache-hit != 'true'
continue-on-error: true
with:
severity: warn
details: The custom github runnners cache was missed and failed to restore
the cache from minio bucket
webhookUrl: ${{ inputs.discord_webhook }}
# Disabled for now because it doesn't work well with multiple parallel jobs
# - uses: syphar/restore-pip-download-cache@v1
# with:
# requirement_files: 'pyproject.toml'
"C:\Program Files\Git\bin\git.exe" config --global user.name "ZenML
GmbH"
# - name: Get current week
# shell: bash
# id: date
# run: echo "::set-output name=week::$(date +'calendar-week-%W')"
# - uses: syphar/restore-virtualenv@v1
# if: ${{ inputs.os != 'arc-runner-set' }}
# id: cache-virtualenv
# with:
# requirement_files: pyproject.toml
# # The virtualenv cache is invalidated when:
# # - manually triggered by means of a custom cache version token
# # - on a weekly basis
# # - any of the integration requirements change (a hash of the
# # __init__.py files is included in the cache key)
# custom_cache_key_element: ${{ inputs.cache_version }}-${{steps.date.outputs.week}}-${{inputs.install_integrations}}-${{
# hashFiles('src/zenml/integrations/*/__init__.py') }}
# - uses: tespkg/actions-cache@v1
# if: ${{ inputs.os == 'arc-runner-set' }}
# id: custom-cache-pip
# env:
# AWS_ACCESS_KEY_ID: ${{ inputs.runners_cache_access_key_id }}
# AWS_SECRET_ACCESS_KEY: ${{ inputs.runners_cache_secret_access_key }}
# with:
# endpoint: minio-service.minio.svc.cluster.local # optional
# insecure: true # optional, use http instead of https. default false
# bucket: caching # required
# use-fallback: false # optional, use github actions cache fallback, default false
# key: ${{ inputs.os }}-${{ inputs.cache_version }}-${{ inputs.python-version
# }}-${{inputs.install_integrations}}
# path: |
# ~/.cache/pip
# restore-keys: |
# ${{ inputs.os }}-${{ inputs.cache_version }}-${{ inputs.python-version }}-${{inputs.install_integrations}}
# - name: Custom runners cache miss
# uses: rjstone/discord-webhook-notify@v1
# if: steps.custom-cache-pip.outputs.cache-hit != 'true'
# continue-on-error: true
# with:
# severity: warn
# details: The custom github runnners cache was missed and failed to restore
# the cache from minio bucket
# webhookUrl: ${{ inputs.discord_webhook }}
# # Disabled for now because it doesn't work well with multiple parallel jobs
# # - uses: syphar/restore-pip-download-cache@v1
# # with:
# # requirement_files: 'pyproject.toml'
# # The pip download cache can be updated on a weekly basis as new packages
# # don't appear that often
# custom_cache_key_element: ${{ inputs.cache_version }}-${{ inputs.python-version }}-${{steps.date.outputs.week}}
# # custom_cache_key_element: ${{ inputs.cache_version }}-${{ inputs.python-version }}-${{steps.date.outputs.week}}
- name: Install Terraform (Windows)
if: ${{ inputs.os == 'windows-latest' }}
shell: bash
Expand All @@ -124,5 +122,5 @@ runs:
shell: bash
run: |-
zenml integration list
pip list
uv pip list
pip check || true
7 changes: 5 additions & 2 deletions .github/workflows/ci-fast.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ jobs:
uses: actions/setup-python@v5.0.0
with:
python-version: '3.10'
- name: Install current package as editable
run: pip install -U darglint
- name: Install darglint using uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
source $HOME/.cargo/env
uv pip install --system darglint
- name: Check docstrings
run: bash scripts/docstring.sh
sqlite-db-migration-testing:
Expand Down
20 changes: 13 additions & 7 deletions .github/workflows/ci-slow.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
name: ci-slow
on:
workflow_dispatch:
workflow_call:
push:
branches: [main]
paths-ignore: [docs/**, docker/**, '*', '!pyproject.toml', '**.md']
Expand Down Expand Up @@ -48,7 +50,10 @@ jobs:
with:
python-version: '3.10'
- name: Install current package as editable
run: pip install -U darglint
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
source $HOME/.cargo/env
uv pip install --system darglint
- name: Check docstrings
run: bash scripts/docstring.sh
sqlite-db-migration-testing:
Expand Down Expand Up @@ -80,10 +85,11 @@ jobs:
python-version: '3.8'
- name: Install current package as editable
run: |
pip install -U pip
pip install -e .
curl -LsSf https://astral.sh/uv/install.sh | sh
source $HOME/.cargo/env
uv pip install --system -e .
- name: Install mlstacks package
run: pip install mlstacks
run: uv pip install --system mlstacks
- name: Check for broken dependencies
run: pip check
- name: Markdown link check
Expand All @@ -98,13 +104,13 @@ jobs:
continue-on-error: true
- name: Security check
run: |
pip install bandit
uv pip install --system bandit
bash scripts/check-security.sh
- name: Check for alembic branch divergence
env:
ZENML_DEBUG: 0
run: |
pip install alembic
uv pip install --system alembic
bash scripts/check-alembic-branches.sh
custom-ubuntu-unit-test:
if: github.event.pull_request.draft == false
Expand Down Expand Up @@ -187,7 +193,7 @@ jobs:
- docker-server-docker-orchestrator-mysql
- docker-server-docker-orchestrator-mariadb
exclude:
# docker is time-consuming to run, so we only run it on 3.8
# docker is time-consuming to run, so we only run it on 3.8
- test_environment: docker-server-docker-orchestrator-mysql
python-version: '3.9'
- test_environment: docker-server-docker-orchestrator-mysql
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/generate-test-duration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
ZENML_DEBUG: 1
ZENML_ANALYTICS_OPT_IN: false
PYTHONIOENCODING: utf-8
UV_HTTP_TIMEOUT: 600
# on MAC OS, we need to set this environment variable
# to fix problems with the fork() calls (see this thread
# for more information: http://sealiesoftware.com/blog/archive/2017/6/5/Objective-C_and_fork_in_macOS_1013.html)
Expand Down Expand Up @@ -53,5 +54,5 @@ jobs:
- name: Verify Python Env unaffected
run: |-
zenml integration list
pip list
uv pip list
pip check || true
7 changes: 4 additions & 3 deletions .github/workflows/integration-test-fast.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ jobs:
ZENML_DEBUG: 1
ZENML_ANALYTICS_OPT_IN: false
PYTHONIOENCODING: utf-8
UV_HTTP_TIMEOUT: 600
# on MAC OS, we need to set this environment variable
# to fix problems with the fork() calls (see this thread
# for more information: http://sealiesoftware.com/blog/archive/2017/6/5/Objective-C_and_fork_in_macOS_1013.html)
Expand Down Expand Up @@ -150,8 +151,8 @@ jobs:
- name: Install docker-compose for non-default environments
if: inputs.test_environment != 'default'
run: |
pip install pyyaml==5.3.1
pip install docker-compose
pip install uv
uv pip install --system "pyyaml==5.3.1" docker-compose
- name: Install Linux System Dependencies
if: (inputs.os == 'ubuntu-latest' || inputs.os == 'arc-runner-set')
run: sudo apt install graphviz
Expand Down Expand Up @@ -227,5 +228,5 @@ jobs:
- name: Verify Python Env unaffected
run: |-
zenml integration list
pip list
uv pip list
pip check || true
7 changes: 4 additions & 3 deletions .github/workflows/integration-test-slow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ jobs:
ZENML_DEBUG: 1
ZENML_ANALYTICS_OPT_IN: false
PYTHONIOENCODING: utf-8
UV_HTTP_TIMEOUT: 600
# on MAC OS, we need to set this environment variable
# to fix problems with the fork() calls (see this thread
# for more information: http://sealiesoftware.com/blog/archive/2017/6/5/Objective-C_and_fork_in_macOS_1013.html)
Expand Down Expand Up @@ -148,8 +149,8 @@ jobs:
- name: Install docker-compose for non-default environments
if: inputs.test_environment != 'default'
run: |
pip install pyyaml==5.3.1
pip install docker-compose
pip install uv
uv pip install --system "pyyaml==5.3.1" docker-compose
- name: Install Linux System Dependencies
if: (inputs.os == 'ubuntu-latest' || inputs.os == 'arc-runner-set')
run: sudo apt install graphviz
Expand Down Expand Up @@ -229,5 +230,5 @@ jobs:
- name: Verify Python Env unaffected
run: |-
zenml integration list
pip list
uv pip list
pip check || true
6 changes: 4 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ jobs:
with:
python-version: '3.8'
- name: Install current package as editable
run: pip install -e .
run: |
pip install -U uv
uv pip install --system -e .
- name: Install mlstacks package
run: pip install mlstacks
run: uv pip install --system mlstacks
- name: Check for broken dependencies
run: pip check
mysql-db-migration-testing:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ jobs:
ZENML_DEBUG: 1
ZENML_ANALYTICS_OPT_IN: false
PYTHONIOENCODING: utf-8
UV_HTTP_TIMEOUT: 600

# on MAC OS, we need to set this environment variable
# to fix problems with the fork() calls (see this thread
Expand Down Expand Up @@ -114,5 +115,5 @@ jobs:
- name: Verify Python Env unaffected
run: |-
zenml integration list
pip list
uv pip list
pip check || true
4 changes: 2 additions & 2 deletions examples/quickstart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Along the way we will also show you how to:

You can use Google Colab to see ZenML in action, no signup / installation required!

<a href="https://colab.research.google.com/github/zenml-io/zenml/blob/main/examples/quickstart/quickstart.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
<a href="https://colab.research.google.com/github/zenml-io/zenml/blob/main/examples/quickstart/run.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>

## :computer: Run Locally

Expand Down Expand Up @@ -208,4 +208,4 @@ The best way to get a production ZenML instance up and running with all batterie
Also, make sure to join our <a href="https://zenml.io/slack" target="_blank">
<img width="15" src="https://cdn3.iconfinder.com/data/icons/logos-and-brands-adobe/512/306_Slack-512.png" alt="Slack"/>
<b>Slack Community</b>
</a> to become part of the ZenML family!
</a> to become part of the ZenML family!
5 changes: 3 additions & 2 deletions scripts/generate-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ rm docs/mkdocs/index.md || true

################################################ Install Requirements ##################################################
if [ -z "$SKIP_INSTALL" ]; then
pip3 install -e ".[server,dev]"
pip3 install "Jinja2==3.0.3"
pip3 install uv
uv pip install --system -e ".[server,dev]"
uv pip install --system "Jinja2==3.0.3"
fi

################################# Initialize DB and delete unnecessary alembic files ###################################
Expand Down
22 changes: 3 additions & 19 deletions scripts/install-zenml-dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,7 @@ parse_args () {
install_zenml() {
# install ZenML in editable mode

touch zenml_requirements.txt
echo "-e .[server,templates,terraform,secrets-aws,secrets-gcp,secrets-azure,secrets-hashicorp,s3fs,gcsfs,adlfs,dev,mlstacks]" >> zenml_requirements.txt

cp zenml_requirements.txt zenml_requirements.in
uv pip compile zenml_requirements.in -o zenml_requirements-compiled.txt

pip install -r zenml_requirements-compiled.txt
rm zenml_requirements.txt
rm zenml_requirements.in
uv pip install --system -e ".[server,templates,terraform,secrets-aws,secrets-gcp,secrets-azure,secrets-hashicorp,s3fs,gcsfs,adlfs,dev,mlstacks]"
}

install_integrations() {
Expand Down Expand Up @@ -63,19 +55,11 @@ install_integrations() {
echo "pyyaml>=6.0.1" >> integration-requirements.txt
echo "pyopenssl" >> integration-requirements.txt
echo "-e .[server,templates,terraform,secrets-aws,secrets-gcp,secrets-azure,secrets-hashicorp,s3fs,gcsfs,adlfs,dev,mlstacks]" >> integration-requirements.txt
cp integration-requirements.txt integration-requirements.in

pip install uv

uv pip compile integration-requirements.in -o integration-requirements-compiled.txt

pip install -r integration-requirements-compiled.txt
uv pip install --system -r integration-requirements.txt
rm integration-requirements.txt
rm integration-requirements.in
rm integration-requirements-compiled.txt
}


set -x
set -e

Expand All @@ -84,7 +68,7 @@ export ZENML_ANALYTICS_OPT_IN=false

parse_args "$@"

python -m pip install --upgrade pip setuptools wheel uv
python -m pip install --upgrade setuptools wheel pip uv

install_zenml

Expand Down
Loading
Loading