Skip to content

Commit 31fee39

Browse files
authored
Feat/use uv python management (#994)
* Remove requirements files and add dependencies into pyproject.toml instead * Remove old conda files since we will use uv as our primary method for developers to set up environments * Working through CI changes to use uv instead of pip and conda * Add uv lock to exclude files * Revert "Remove old conda files since we will use uv as our primary method for developers to set up environments" This reverts commit 88aff7e. * Windows workflows don't use source command * Add in extra include for ignoreing rat * Use uv commands in CI * Remove conda recipes and CI stages * Working on CI using uv * Install doc requirements * Remove caching uv * Set uv venv * Add requirements for building * Revert github action to allowed one * Call uv sync with verbose mode so users can see the build occuring in CI * Test setting specific hash on action * Test setting rust-toolchain github action with pinned version * Testing night rust toolchain against apache rejection criteria * Github action is fickle with the pattern matching * Switch all Ci to use nightly rust toolchain until infra team whitelists the stable toolchain * Speed up CI by preventing build during uv sync * Additional uv commands missing no-project option * Setting python versions of dependencies to match lowest supported python version, 3.8 * Update maturin and move to deps for dev * CI ordering was wrong and maturin needed uv option * Switch to stable toolchain * uv requires two dashes * Submodule init * change directories for unit tests * Add deps for build * Maturin build doesn't take uv as parameter * Update documentation for setting up with uv * Enable cache in CI * Update documentation to use uv * Small adjustment to CI config
1 parent 39fec53 commit 31fee39

26 files changed

+2031
-1207
lines changed

.github/workflows/build.yml

+31-31
Original file line numberDiff line numberDiff line change
@@ -31,28 +31,33 @@ jobs:
3131
- name: Install Python
3232
uses: actions/setup-python@v5
3333
with:
34-
python-version: "3.11"
34+
python-version: "3.12"
35+
36+
- uses: astral-sh/setup-uv@v5
37+
with:
38+
enable-cache: true
39+
40+
# Use the --no-install-package to only install the dependencies
41+
# but do not yet build the rust library
3542
- name: Install dependencies
36-
run: |
37-
python -m pip install --upgrade pip
38-
pip install ruff
43+
run: uv sync --dev --no-install-package datafusion
44+
3945
# Update output format to enable automatic inline annotations.
4046
- name: Run Ruff
4147
run: |
42-
ruff check --output-format=github python/
43-
ruff format --check python/
48+
uv run --no-project ruff check --output-format=github python/
49+
uv run --no-project ruff format --check python/
4450
4551
generate-license:
4652
runs-on: ubuntu-latest
4753
steps:
4854
- uses: actions/checkout@v4
49-
- uses: actions-rs/toolchain@v1
55+
- uses: astral-sh/setup-uv@v5
5056
with:
51-
profile: minimal
52-
toolchain: stable
53-
override: true
57+
enable-cache: true
58+
5459
- name: Generate license file
55-
run: python ./dev/create_license.py
60+
run: uv run --no-project python ./dev/create_license.py
5661
- uses: actions/upload-artifact@v4
5762
with:
5863
name: python-wheel-license
@@ -74,15 +79,7 @@ jobs:
7479
with:
7580
python-version: ${{ matrix.python-version }}
7681

77-
- uses: actions-rs/toolchain@v1
78-
with:
79-
toolchain: stable
80-
81-
- name: Upgrade pip
82-
run: python -m pip install --upgrade pip
83-
84-
- name: Install maturin
85-
run: pip install maturin==1.5.1
82+
- uses: dtolnay/rust-toolchain@stable
8683

8784
- run: rm LICENSE.txt
8885
- name: Download LICENSE.txt
@@ -97,8 +94,14 @@ jobs:
9794
version: "27.4"
9895
repo-token: ${{ secrets.GITHUB_TOKEN }}
9996

97+
- uses: astral-sh/setup-uv@v5
98+
with:
99+
enable-cache: true
100+
100101
- name: Build Python package
101-
run: maturin build --release --strip --features substrait
102+
run: |
103+
uv sync --dev --no-install-package datafusion
104+
uv run --no-project maturin build --release --strip --features substrait
102105
103106
- name: List Windows wheels
104107
if: matrix.os == 'windows-latest'
@@ -132,15 +135,7 @@ jobs:
132135
with:
133136
python-version: ${{ matrix.python-version }}
134137

135-
- uses: actions-rs/toolchain@v1
136-
with:
137-
toolchain: stable
138-
139-
- name: Upgrade pip
140-
run: python -m pip install --upgrade pip
141-
142-
- name: Install maturin
143-
run: pip install maturin==1.5.1
138+
- uses: dtolnay/rust-toolchain@stable
144139

145140
- run: rm LICENSE.txt
146141
- name: Download LICENSE.txt
@@ -155,9 +150,14 @@ jobs:
155150
version: "27.4"
156151
repo-token: ${{ secrets.GITHUB_TOKEN }}
157152

153+
- uses: astral-sh/setup-uv@v5
154+
with:
155+
enable-cache: true
156+
158157
- name: Build Python package
159158
run: |
160-
maturin build --release --strip --features substrait
159+
uv sync --dev --no-install-package datafusion
160+
uv run --no-project maturin build --release --strip --features substrait
161161
162162
- name: List Mac wheels
163163
run: find target/wheels/

.github/workflows/conda.yml

-107
This file was deleted.

.github/workflows/docs.yaml

+10-13
Original file line numberDiff line numberDiff line change
@@ -57,27 +57,24 @@ jobs:
5757
version: '27.4'
5858
repo-token: ${{ secrets.GITHUB_TOKEN }}
5959

60-
- name: Install dependencies
61-
run: |
62-
set -x
63-
python3 -m venv venv
64-
source venv/bin/activate
65-
pip install -r requirements-311.txt
66-
pip install -r docs/requirements.txt
67-
- name: Build Datafusion
60+
- name: Install dependencies and build
61+
uses: astral-sh/setup-uv@v5
62+
with:
63+
enable-cache: true
64+
65+
- name: Build repo
6866
run: |
69-
set -x
70-
source venv/bin/activate
71-
maturin develop
67+
uv venv
68+
uv sync --dev --no-install-package datafusion --group docs
69+
uv run --no-project maturin develop --uv
7270
7371
- name: Build docs
7472
run: |
7573
set -x
76-
source venv/bin/activate
7774
cd docs
7875
curl -O https://gist.githubusercontent.com/ritchie46/cac6b337ea52281aa23c049250a4ff03/raw/89a957ff3919d90e6ef2d34235e6bf22304f3366/pokemon.csv
7976
curl -O https://d37ci6vzurychx.cloudfront.net/trip-data/yellow_tripdata_2021-01.parquet
80-
make html
77+
uv run --no-project make html
8178
8279
- name: Copy & push the generated HTML
8380
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref_type == 'tag')

.github/workflows/test.yaml

+16-43
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,10 @@ jobs:
4343
- uses: actions/checkout@v4
4444

4545
- name: Setup Rust Toolchain
46-
uses: actions-rs/toolchain@v1
46+
uses: dtolnay/rust-toolchain@stable
4747
id: rust-toolchain
4848
with:
49-
toolchain: ${{ matrix.toolchain }}
50-
override: true
49+
components: clippy,rustfmt
5150

5251
- name: Install Protoc
5352
uses: arduino/setup-protoc@v3
@@ -64,60 +63,35 @@ jobs:
6463
uses: actions/cache@v4
6564
with:
6665
path: ~/.cargo
67-
key: cargo-cache-${{ steps.rust-toolchain.outputs.rustc_hash }}-${{ hashFiles('Cargo.lock') }}
66+
key: cargo-cache-${{ steps.rust-toolchain.outputs.cachekey }}-${{ hashFiles('Cargo.lock') }}
6867

6968
- name: Check Formatting
70-
uses: actions-rs/cargo@v1
7169
if: ${{ matrix.python-version == '3.10' && matrix.toolchain == 'stable' }}
72-
with:
73-
command: fmt
74-
args: -- --check
70+
run: cargo fmt -- --check
7571

7672
- name: Run Clippy
77-
uses: actions-rs/cargo@v1
7873
if: ${{ matrix.python-version == '3.10' && matrix.toolchain == 'stable' }}
79-
with:
80-
command: clippy
81-
args: --all-targets --all-features -- -D clippy::all -A clippy::redundant_closure
82-
83-
- name: Create Virtualenv (3.12)
84-
if: ${{ matrix.python-version == '3.12' }}
85-
run: |
86-
python -m venv venv
87-
source venv/bin/activate
88-
pip install -r requirements-312.txt
74+
run: cargo clippy --all-targets --all-features -- -D clippy::all -A clippy::redundant_closure
8975

90-
- name: Create Virtualenv (3.10)
91-
if: ${{ matrix.python-version == '3.10' }}
92-
run: |
93-
python -m venv venv
94-
source venv/bin/activate
95-
pip install -r requirements-310.txt
96-
97-
- name: Create Virtualenv (3.11)
98-
if: ${{ matrix.python-version == '3.11' }}
99-
run: |
100-
python -m venv venv
101-
source venv/bin/activate
102-
pip install -r requirements-311.txt
76+
- name: Install dependencies and build
77+
uses: astral-sh/setup-uv@v5
78+
with:
79+
enable-cache: true
10380

10481
- name: Run tests
10582
env:
10683
RUST_BACKTRACE: 1
10784
run: |
10885
git submodule update --init
109-
source venv/bin/activate
110-
pip install -e . -vv
111-
pytest -v .
86+
uv sync --dev --no-install-package datafusion
87+
uv run --no-project maturin develop --uv
88+
uv run --no-project pytest -v .
11289
11390
- name: FFI unit tests
11491
run: |
115-
source venv/bin/activate
116-
pip install -e . -vv
117-
pip install maturin==1.5.1
11892
cd examples/ffi-table-provider
119-
maturin develop --release --strip
120-
pytest python/tests/_test_table_provider.py
93+
uv run --no-project maturin develop --uv
94+
uv run --no-project pytest python/tests/_test_table_provider.py
12195
12296
- name: Cache the generated dataset
12397
id: cache-tpch-dataset
@@ -134,7 +108,6 @@ jobs:
134108
135109
- name: Run TPC-H examples
136110
run: |
137-
source venv/bin/activate
138111
cd examples/tpch
139-
python convert_data_to_parquet.py
140-
pytest _tests.py
112+
uv run --no-project python convert_data_to_parquet.py
113+
uv run --no-project pytest _tests.py

.pre-commit-config.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717

1818
repos:
1919
- repo: https://github.com/rhysd/actionlint
20-
rev: v1.6.23
20+
rev: v1.7.6
2121
hooks:
22-
- id: actionlint-docker
22+
- id: actionlint-docker
2323
- repo: https://github.com/astral-sh/ruff-pre-commit
2424
# Ruff version.
2525
rev: v0.3.0

0 commit comments

Comments
 (0)