From ed81ffb597d54f6768419ad3911f9bb73bbbb2e3 Mon Sep 17 00:00:00 2001 From: Jeremy Dyer Date: Thu, 12 Jan 2023 20:45:59 -0500 Subject: [PATCH 1/2] Introduce conda directory containing datafusion-dev.yaml conda environment file, conda build files for building and publishing packages to anaconda.org as well as supporting documentation updates to README.md --- README.md | 22 +++++++++++- conda/environments/datafusion-dev.yaml | 36 +++++++++++++++++++ conda/recipes/build.sh | 20 +++++++++++ conda/recipes/meta.yaml | 50 ++++++++++++++++++++++++++ 4 files changed, 127 insertions(+), 1 deletion(-) create mode 100644 conda/environments/datafusion-dev.yaml create mode 100644 conda/recipes/build.sh create mode 100644 conda/recipes/meta.yaml diff --git a/README.md b/README.md index 35186a970..3cd144b24 100644 --- a/README.md +++ b/README.md @@ -149,12 +149,18 @@ assert result.column(0) == pyarrow.array([6.0]) ## How to install (from pip) +### Pip ```bash pip install datafusion # or python -m pip install datafusion ``` +### Conda +```bash +conda install -c conda-forge datafusion +``` + You can verify the installation by running: ```python @@ -163,11 +169,25 @@ You can verify the installation by running: '0.6.0' ``` + ## How to develop This assumes that you have rust and cargo installed. We use the workflow recommended by [pyo3](https://github.com/PyO3/pyo3) and [maturin](https://github.com/PyO3/maturin). -Bootstrap: +The Maturin tools used in this workflow can be installed either via Conda or Pip. Both approaches should offer the same experience. Multiple approaches are only offered to appease developer preference. Bootstrapping for both Conda and Pip are as follows. + +Bootstrap (Conda): + +```bash +# fetch this repo +git clone git@github.com:apache/arrow-datafusion-python.git +# create the conda environment for dev +conda env create -f ./conda/environments/datafusion-dev.yaml -n datafusion-dev +# activate the conda environment +conda activate datafusion-dev +``` + +Bootstrap (Pip): ```bash # fetch this repo diff --git a/conda/environments/datafusion-dev.yaml b/conda/environments/datafusion-dev.yaml new file mode 100644 index 000000000..cf0db6dda --- /dev/null +++ b/conda/environments/datafusion-dev.yaml @@ -0,0 +1,36 @@ +# 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 +- mypy +- numpy +- pyarrow +- pytest +- toml +- importlib_metadata +- python>=3.7,<3.11 +# Packages useful for building distributions and releasing +- mamba +- conda-build +- anaconda-client +name: datafusion-dev diff --git a/conda/recipes/build.sh b/conda/recipes/build.sh new file mode 100644 index 000000000..f10be3581 --- /dev/null +++ b/conda/recipes/build.sh @@ -0,0 +1,20 @@ +#!/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. + +maturin build -r diff --git a/conda/recipes/meta.yaml b/conda/recipes/meta.yaml new file mode 100644 index 000000000..cce614b2f --- /dev/null +++ b/conda/recipes/meta.yaml @@ -0,0 +1,50 @@ +# 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 version = environ.get('GIT_DESCRIBE_TAG', '0.0.0.dev').lstrip('v') + environ.get('VERSION_SUFFIX', '') %} +{% set minor_version = version.split('.')[0] + '.' + version.split('.')[1] %} + +package: + name: datafusion + version: {{ version }} + +source: + git_url: ../.. + +build: + noarch: python + number: 0 + +requirements: + host: + - {{ compiler('rust') }} + - python + - setuptools + - maturin + run: + - python + +test: + imports: + - datafusion + +about: + home: https://arrow.apache.org/datafusion + license: Apache-2.0 + license_family: APACHE + license_file: LICENSE.txt + summary: Apache Arrow DataFusion Python Bindings From 49a5d9a9837255e811746b7e41de40d6dd0bc00b Mon Sep 17 00:00:00 2001 From: Jeremy Dyer Date: Fri, 13 Jan 2023 13:51:27 -0500 Subject: [PATCH 2/2] Added notes for performing conda release --- conda/environments/datafusion-dev.yaml | 5 +++++ dev/release/README.md | 23 +++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/conda/environments/datafusion-dev.yaml b/conda/environments/datafusion-dev.yaml index cf0db6dda..0e17e1699 100644 --- a/conda/environments/datafusion-dev.yaml +++ b/conda/environments/datafusion-dev.yaml @@ -33,4 +33,9 @@ dependencies: - mamba - conda-build - anaconda-client +# Packages for documentation building +- sphinx +- pydata-sphinx-theme==0.8.0 +- myst-parser +- jinja2 name: datafusion-dev diff --git a/dev/release/README.md b/dev/release/README.md index fd77f75cc..00eb8bb93 100644 --- a/dev/release/README.md +++ b/dev/release/README.md @@ -148,6 +148,29 @@ This will create a file named `dist/datafusion-0.7.0.tar.gz`. Upload this to tes python3 -m twine upload --repository testpypi dist/datafusion-0.7.0.tar.gz ``` +### Publish Python Artifacts to Anaconda + +Publishing artifacts to Anaconda is similar to PyPi. First, Download the source tarball created in the previous step and untar it. + +```bash +# Assuming you have an existing conda environment named `datafusion-dev` if not see root README for instructions +conda activate datafusion-dev +conda build . +``` + +This will setup a virtual conda environment and build the artifacts inside of that virtual env. This step can take a few minutes as the entire build, host, and runtime environments are setup. Once complete a local filesystem path will be emitted for the location of the resulting package. Observe that path and copy to your clipboard. + +Ex: `/home/conda/envs/datafusion/conda-bld/linux-64/datafusion-0.7.0.tar.bz2` + +Now you are ready to publish this resulting package to anaconda.org. This can be accomplished in a few simple steps. + +```bash +# First login to Anaconda with the datafusion credentials +anaconda login +# Upload the package +anaconda upload /home/conda/envs/datafusion/conda-bld/linux-64/datafusion-0.7.0.tar.bz2 +``` + ### Send the Email Send the email to start the vote.