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

Feat/use uv python management #994

Merged
merged 36 commits into from
Jan 19, 2025
Merged
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
0ed4862
Remove requirements files and add dependencies into pyproject.toml in…
timsaucer Jan 12, 2025
88aff7e
Remove old conda files since we will use uv as our primary method for…
timsaucer Jan 12, 2025
32604e3
Working through CI changes to use uv instead of pip and conda
timsaucer Jan 12, 2025
21ac4a8
Add uv lock to exclude files
timsaucer Jan 12, 2025
2857364
Revert "Remove old conda files since we will use uv as our primary me…
timsaucer Jan 12, 2025
5c33fb2
Windows workflows don't use source command
timsaucer Jan 12, 2025
892d305
Add in extra include for ignoreing rat
timsaucer Jan 13, 2025
56c7e93
Use uv commands in CI
timsaucer Jan 13, 2025
8054104
Remove conda recipes and CI stages
timsaucer Jan 13, 2025
4ee66ac
Working on CI using uv
timsaucer Jan 13, 2025
774510b
Install doc requirements
timsaucer Jan 13, 2025
f0b2234
Remove caching uv
timsaucer Jan 13, 2025
9196f59
Set uv venv
timsaucer Jan 13, 2025
5ae5d6e
Add requirements for building
timsaucer Jan 13, 2025
442d83b
Revert github action to allowed one
timsaucer Jan 13, 2025
da3a519
Call uv sync with verbose mode so users can see the build occuring in CI
timsaucer Jan 13, 2025
e2bf5d9
Test setting specific hash on action
timsaucer Jan 13, 2025
d6b8b41
Test setting rust-toolchain github action with pinned version
timsaucer Jan 14, 2025
d94d703
Testing night rust toolchain against apache rejection criteria
timsaucer Jan 14, 2025
338794f
Github action is fickle with the pattern matching
timsaucer Jan 14, 2025
4cfa108
Switch all Ci to use nightly rust toolchain until infra team whitelis…
timsaucer Jan 14, 2025
f547fe2
Speed up CI by preventing build during uv sync
timsaucer Jan 14, 2025
1f35a56
Additional uv commands missing no-project option
timsaucer Jan 14, 2025
6179d9b
Setting python versions of dependencies to match lowest supported pyt…
timsaucer Jan 14, 2025
e27831d
Update maturin and move to deps for dev
timsaucer Jan 14, 2025
d299124
CI ordering was wrong and maturin needed uv option
timsaucer Jan 14, 2025
49be265
Switch to stable toolchain
timsaucer Jan 14, 2025
5307acf
uv requires two dashes
timsaucer Jan 14, 2025
7c61b04
Submodule init
timsaucer Jan 14, 2025
a33d110
change directories for unit tests
timsaucer Jan 14, 2025
eeb88bd
Add deps for build
timsaucer Jan 14, 2025
29437b3
Maturin build doesn't take uv as parameter
timsaucer Jan 14, 2025
6491bdf
Update documentation for setting up with uv
timsaucer Jan 14, 2025
9c0c8dc
Enable cache in CI
timsaucer Jan 14, 2025
755a8f5
Update documentation to use uv
timsaucer Jan 14, 2025
48890c3
Small adjustment to CI config
timsaucer Jan 19, 2025
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
Prev Previous commit
Next Next commit
Revert "Remove old conda files since we will use uv as our primary me…
…thod for developers to set up environments"

This reverts commit 88aff7e.
timsaucer committed Jan 12, 2025
commit 285736492fb04822552071fb610bcb7c29ac4844
44 changes: 44 additions & 0 deletions conda/environments/datafusion-cuda-dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

channels:
- conda-forge
dependencies:
- black
- flake8
- isort
- maturin>=1.5.1
- mypy
- numpy
- pyarrow>=11.0.0
- pytest
- toml
- importlib_metadata
- python>=3.10
# Packages useful for building distributions and releasing
- mamba
- conda-build
- anaconda-client
# Packages for documentation building
- sphinx
- pydata-sphinx-theme==0.8.0
- myst-parser
- jinja2
# GPU packages
- cudf
- cudatoolkit=11.8
name: datafusion-dev
41 changes: 41 additions & 0 deletions conda/environments/datafusion-dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

channels:
- conda-forge
dependencies:
- black
- flake8
- isort
- maturin>=1.5.1
- mypy
- numpy
- pyarrow>=11.0.0
- pytest
- toml
- importlib_metadata
- python>=3.10
# Packages useful for building distributions and releasing
- mamba
- conda-build
- anaconda-client
# Packages for documentation building
- sphinx
- pydata-sphinx-theme==0.8.0
- myst-parser
- jinja2
name: datafusion-dev
26 changes: 26 additions & 0 deletions conda/recipes/bld.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#

maturin build -vv -j %CPU_COUNT% --release --strip --features substrait --manylinux off --interpreter=%PYTHON%

FOR /F "delims=" %%i IN ('dir /s /b target\wheels\*.whl') DO set datafusion_wheel=%%i

%PYTHON% -m pip install --no-deps %datafusion_wheel% -vv

cargo-bundle-licenses --format yaml --output THIRDPARTY.yml
84 changes: 84 additions & 0 deletions conda/recipes/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#

set -ex

# See https://github.com/conda-forge/rust-feedstock/blob/master/recipe/build.sh for cc env explanation
if [ "$c_compiler" = gcc ] ; then
case "$target_platform" in
linux-64) rust_env_arch=X86_64_UNKNOWN_LINUX_GNU ;;
linux-aarch64) rust_env_arch=AARCH64_UNKNOWN_LINUX_GNU ;;
linux-ppc64le) rust_env_arch=POWERPC64LE_UNKNOWN_LINUX_GNU ;;
*) echo "unknown target_platform $target_platform" ; exit 1 ;;
esac

export CARGO_TARGET_${rust_env_arch}_LINKER=$CC
fi

declare -a _xtra_maturin_args

mkdir -p $SRC_DIR/.cargo

if [ "$target_platform" = "osx-64" ] ; then
cat <<EOF >> $SRC_DIR/.cargo/config
[target.x86_64-apple-darwin]
linker = "$CC"
rustflags = [
"-C", "link-arg=-undefined",
"-C", "link-arg=dynamic_lookup",
]

EOF

_xtra_maturin_args+=(--target=x86_64-apple-darwin)

elif [ "$target_platform" = "osx-arm64" ] ; then
cat <<EOF >> $SRC_DIR/.cargo/config
# Required for intermediate codegen stuff
[target.x86_64-apple-darwin]
linker = "$CC_FOR_BUILD"

# Required for final binary artifacts for target
[target.aarch64-apple-darwin]
linker = "$CC"
rustflags = [
"-C", "link-arg=-undefined",
"-C", "link-arg=dynamic_lookup",
]

EOF
_xtra_maturin_args+=(--target=aarch64-apple-darwin)

# This variable must be set to the directory containing the target's libpython DSO
export PYO3_CROSS_LIB_DIR=$PREFIX/lib

# xref: https://github.com/PyO3/pyo3/commit/7beb2720
export PYO3_PYTHON_VERSION=${PY_VER}

# xref: https://github.com/conda-forge/python-feedstock/issues/621
sed -i.bak 's,aarch64,arm64,g' $BUILD_PREFIX/venv/lib/os-patch.py
sed -i.bak 's,aarch64,arm64,g' $BUILD_PREFIX/venv/lib/platform-patch.py
fi

maturin build -vv -j "${CPU_COUNT}" --release --strip --features substrait --manylinux off --interpreter="${PYTHON}" "${_xtra_maturin_args[@]}"

"${PYTHON}" -m pip install $SRC_DIR/target/wheels/datafusion*.whl --no-deps -vv

cargo-bundle-licenses --format yaml --output THIRDPARTY.yml
75 changes: 75 additions & 0 deletions conda/recipes/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

{% set name = "datafusion" %}
{% set major_minor_patch = environ.get('GIT_DESCRIBE_TAG', '0.0.0.dev').split('.') %}
{% set new_patch = major_minor_patch[2] | int + 1 %}
{% set version = (major_minor_patch[:2] + [new_patch]) | join('.') + environ.get('VERSION_SUFFIX', '') %}


package:
name: {{ name|lower }}
version: {{ version }}

source:
git_url: ../..

build:
number: {{ GIT_DESCRIBE_NUMBER }}
string: py{{ python | replace(".", "") }}_{{ GIT_DESCRIBE_HASH }}_{{ GIT_DESCRIBE_NUMBER }}

requirements:
build:
- python # [build_platform != target_platform]
- cross-python_{{ target_platform }} # [build_platform != target_platform]
- zlib # [build_platform != target_platform]
- {{ compiler('c') }}
- {{ compiler('rust') }}
- cargo-bundle-licenses
- maturin >=1.5.1,<1.6.0
- libprotobuf =3
host:
- python
- maturin >=1.5.1,<1.6.0
- pip
- zlib
- xz # [linux64]
run:
- python
- pyarrow >=11.0.0
- typing_extensions

test:
imports:
- datafusion
commands:
- pip check
requires:
- pip

about:
home: https://arrow.apache.org/datafusion
license: Apache-2.0
license_family: APACHE
license_file:
- LICENSE.txt
- THIRDPARTY.yml
description: |
DataFusion is an extensible query execution framework, written in Rust,
that uses Apache Arrow as its in-memory format.
doc_url: https://arrow.apache.org/datafusion
dev_url: https://github.com/apache/arrow-datafusion