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

ci(python): Use uv for installing Python dependencies in CI #15848

Merged
merged 1 commit into from
Apr 23, 2024
Merged
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
6 changes: 4 additions & 2 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@ jobs:

- name: Create virtual environment
run: |
python -m venv .venv
curl -LsSf https://astral.sh/uv/install.sh | sh
uv venv
echo "$GITHUB_WORKSPACE/.venv/bin" >> $GITHUB_PATH
echo "VIRTUAL_ENV=$GITHUB_WORKSPACE/.venv" >> $GITHUB_ENV

- name: Install Python dependencies
working-directory: py-polars
run: pip install -r requirements-dev.txt
run: uv pip install --compile-bytecode -r requirements-dev.txt

- name: Set up Rust
run: rustup show
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/docs-global.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,15 @@ jobs:

- name: Create virtual environment
run: |
python -m venv .venv
curl -LsSf https://astral.sh/uv/install.sh | sh
uv venv
echo "$GITHUB_WORKSPACE/.venv/bin" >> $GITHUB_PATH
echo "VIRTUAL_ENV=$GITHUB_WORKSPACE/.venv" >> $GITHUB_ENV

- name: Install dependencies
- name: Install Python dependencies
run: |
pip install -r py-polars/requirements-dev.txt
pip install -r docs/requirements.txt
uv pip install -r py-polars/requirements-dev.txt
uv pip install -r docs/requirements.txt

- name: Set up Rust
run: rustup show
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/docs-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,21 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: pip
cache-dependency-path: py-polars/docs/requirements-docs.txt

- name: Create virtual environment
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
uv venv
echo "$GITHUB_WORKSPACE/.venv/bin" >> $GITHUB_PATH
echo "VIRTUAL_ENV=$GITHUB_WORKSPACE/.venv" >> $GITHUB_ENV

- name: Install Python dependencies
working-directory: py-polars/docs
run: pip install -r requirements-docs.txt
run: uv pip install -r requirements-docs.txt

- name: Build Python documentation
working-directory: py-polars/docs
env:
SPHINXOPTS: -W --jobs=auto
POLARS_VERSION: ${{ github.event.client_payload.tag || 'main' }}
run: make html

Expand Down
18 changes: 12 additions & 6 deletions .github/workflows/lint-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ jobs:
fail-fast: false
matrix:
python-version: ['3.8', '3.12']
defaults:
run:
working-directory: py-polars

steps:
- uses: actions/checkout@v4
Expand All @@ -52,11 +49,20 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
- name: Create virtual environment
run: |
pip install -r requirements-dev.txt
pip install -r requirements-lint.txt
curl -LsSf https://astral.sh/uv/install.sh | sh
uv venv
echo "$GITHUB_WORKSPACE/.venv/bin" >> $GITHUB_PATH
echo "VIRTUAL_ENV=$GITHUB_WORKSPACE/.venv" >> $GITHUB_ENV

- name: Install Python dependencies
working-directory: py-polars
run: |
uv pip install -r requirements-dev.txt
uv pip install -r requirements-lint.txt

# Allow untyped calls for older Python versions
- name: Run mypy
working-directory: py-polars
run: mypy ${{ (matrix.python-version == '3.8') && '--allow-untyped-calls' || '' }}
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,18 @@ jobs:

- uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: '3.11'

- name: Create virtual environment
run: |
python -m venv .venv
curl -LsSf https://astral.sh/uv/install.sh | sh
uv venv
echo "$GITHUB_WORKSPACE/.venv/bin" >> $GITHUB_PATH
echo "VIRTUAL_ENV=$GITHUB_WORKSPACE/.venv" >> $GITHUB_ENV

- name: Install dependencies
run: pip install -r py-polars/requirements-dev.txt
- name: Install Python dependencies
working-directory: py-polars
run: uv pip install --compile-bytecode -r requirements-dev.txt

- name: Set up Rust
run: rustup component add llvm-tools-preview
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/test-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,12 @@ jobs:
run: |
python -m venv .venv
echo "$GITHUB_WORKSPACE/py-polars/.venv/$BIN" >> $GITHUB_PATH
echo "VIRTUAL_ENV=$GITHUB_WORKSPACE/py-polars/.venv" >> $GITHUB_ENV

- name: Install dependencies
run: pip install -r requirements-dev.txt
- name: Install Python dependencies
run: |
pip install uv
uv pip install --compile-bytecode -r requirements-dev.txt

- name: Set up Rust
run: rustup show
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ FILTER_PIP_WARNINGS=| grep -v "don't match your environment"; test $${PIPESTATUS
requirements: .venv ## Install/refresh Python project requirements
@unset CONDA_PREFIX \
&& $(VENV_BIN)/python -m pip install --upgrade uv \
&& $(VENV_BIN)/uv pip install --upgrade -r py-polars/requirements-dev.txt \
&& $(VENV_BIN)/uv pip install --upgrade --compile-bytecode -r py-polars/requirements-dev.txt \
&& $(VENV_BIN)/uv pip install --upgrade -r py-polars/requirements-lint.txt \
&& $(VENV_BIN)/uv pip install --upgrade -r py-polars/docs/requirements-docs.txt \
&& $(VENV_BIN)/uv pip install --upgrade -r docs/requirements.txt
Expand Down
1 change: 1 addition & 0 deletions py-polars/requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
maturin
# extra dependency for maturin (linux-only)
patchelf; platform_system == 'Linux'
pip

# ------------
# DEPENDENCIES
Expand Down
Loading