Skip to content

Commit 755a8f5

Browse files
committed
Update documentation to use uv
1 parent 9c0c8dc commit 755a8f5

File tree

7 files changed

+48
-56
lines changed

7 files changed

+48
-56
lines changed

README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,13 +175,17 @@ over `pip`.
175175

176176
Bootstrap (`uv`):
177177

178+
By default `uv` will attempt to build the datafusion python package. For our development we prefer to build manually. This means
179+
that when creating your virtual environment using `uv sync` you need to pass in the additional `--no-install-package datafusion`
180+
and for `uv run` commands the additional parameter `--no-project`
181+
178182
```bash
179183
# fetch this repo
180184
git clone [email protected]:apache/datafusion-python.git
181185
# create the virtual enviornment
182186
uv sync --dev --no-install-package datafusion
183187
# activate the environment
184-
source venv/bin/activate
188+
source .venv/bin/activate
185189
```
186190

187191
Bootstrap (`pip`):
@@ -190,9 +194,9 @@ Bootstrap (`pip`):
190194
# fetch this repo
191195
git clone [email protected]:apache/datafusion-python.git
192196
# prepare development environment (used to build wheel / install in development)
193-
python3 -m venv venv
197+
python3 -m venv .venv
194198
# activate the venv
195-
source venv/bin/activate
199+
source .venv/bin/activate
196200
# update pip itself if necessary
197201
python -m pip install -U pip
198202
# install dependencies
@@ -217,8 +221,8 @@ Alternatively if you are using `uv` you can do the following without
217221
needing to activate the virtual environment:
218222

219223
```bash
220-
uv maturin delelop --uv
221-
uv pytest .
224+
uv run --no-project maturin develop --uv
225+
uv --no-project pytest .
222226
```
223227

224228
### Running & Installing pre-commit hooks

dev/python_lint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
# DataFusion CI does
2222

2323
set -e
24-
source venv/bin/activate
24+
source .venv/bin/activate
2525
flake8 --exclude venv,benchmarks/db-benchmark --ignore=E501,W503
2626
black --line-length 79 .

dev/release/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,8 @@ git checkout 40.0.0-rc1
172172
git submodule update --init --recursive
173173

174174
# create the env
175-
python3 -m venv venv
176-
source venv/bin/activate
175+
python3 -m venv .venv
176+
source .venv/bin/activate
177177

178178
# install release candidate
179179
pip install --extra-index-url https://test.pypi.org/simple/ datafusion==40.0.0

dev/release/verify-release-candidate.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ test_source_distribution() {
125125
git clone https://github.com/apache/arrow-testing.git testing
126126
git clone https://github.com/apache/parquet-testing.git parquet-testing
127127

128-
python3 -m venv venv
129-
source venv/bin/activate
128+
python3 -m venv .venv
129+
source .venv/bin/activate
130130
python3 -m pip install -U pip
131131
python3 -m pip install -r requirements-310.txt
132132
maturin develop

docs/README.md

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,42 +26,32 @@ when changes are merged to the main branch.
2626
## Dependencies
2727

2828
It's recommended to install build dependencies and build the documentation
29-
inside a Python `venv`.
29+
inside a Python `venv` using `uv`.
3030

3131
To prepare building the documentation run the following on the root level of the project:
3232

33-
1. Set up virtual environment if it was not already created
34-
```bash
35-
python3 -m venv venv
36-
```
37-
1. Activate virtual environment
38-
```bash
39-
source venv/bin/activate
40-
```
41-
1. Install Datafusion's Python dependencies
42-
```bash
43-
pip install -r requirements-310.txt
44-
```
45-
1. Install documentation dependencies
46-
```bash
47-
pip install -r docs/requirements.txt
48-
```
33+
```bash
34+
# Set up a virtual environment with the documentation dependencies
35+
uv sync --dev --group docs --no-install-package datafusion
36+
```
4937

5038
## Build & Preview
5139

5240
Run the provided script to build the HTML pages.
5341

5442
```bash
55-
cd docs
56-
./build.sh
43+
# Build the repository
44+
uv run --no-project maturin develop --uv
45+
# Build the documentation
46+
uv run --no-project docs/build.sh
5747
```
5848

59-
The HTML will be generated into a `build` directory.
49+
The HTML will be generated into a `build` directory in `docs`.
6050

6151
Preview the site on Linux by running this command.
6252

6353
```bash
64-
firefox build/html/index.html
54+
firefox docs/build/html/index.html
6555
```
6656

6757
## Release Process

docs/build.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020

2121
set -e
2222

23+
original_dir=$(pwd)
24+
script_dir=$(dirname "$(realpath "$0")")
25+
cd "$script_dir" || exit
26+
2327
if [ ! -f pokemon.csv ]; then
2428
curl -O https://gist.githubusercontent.com/ritchie46/cac6b337ea52281aa23c049250a4ff03/raw/89a957ff3919d90e6ef2d34235e6bf22304f3366/pokemon.csv
2529
fi
@@ -33,3 +37,5 @@ rm -rf temp 2> /dev/null
3337
mkdir temp
3438
cp -rf source/* temp/
3539
make SOURCEDIR=`pwd`/temp html
40+
41+
cd "$original_dir" || exit

docs/source/contributor-guide/introduction.rst

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,24 @@ Doing so is a great way to help the community as well as get more familiar with
2929
How to develop
3030
--------------
3131

32-
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>`_.
32+
This assumes that you have rust and cargo installed. We use the workflow recommended by
33+
`pyo3 <https://github.com/PyO3/pyo3>`_ and `maturin <https://github.com/PyO3/maturin>`_. We recommend using
34+
`uv <https://docs.astral.sh/uv/>`_ for python package management.
35+
36+
By default `uv` will attempt to build the datafusion python package. For our development we prefer to build manually. This means
37+
that when creating your virtual environment using `uv sync` you need to pass in the additional `--no-install-package datafusion`
38+
and for `uv run` commands the additional parameter `--no-project`
3339

3440
Bootstrap:
3541

3642
.. code-block:: shell
3743
3844
# fetch this repo
39-
git clone [email protected]:apache/arrow-datafusion-python.git
40-
# prepare development environment (used to build wheel / install in development)
41-
python3 -m venv venv
42-
# activate the venv
43-
source venv/bin/activate
44-
# update pip itself if necessary
45-
python -m pip install -U pip
46-
# install dependencies (for Python 3.8+)
47-
python -m pip install -r requirements-310.txt
45+
git clone [email protected]:apache/datafusion-python.git
46+
# create the virtual enviornment
47+
uv sync --dev --no-install-package datafusion
48+
# activate the environment
49+
source .venv/bin/activate
4850
4951
The tests rely on test data in git submodules.
5052

@@ -58,8 +60,8 @@ Whenever rust code changes (your changes or via `git pull`):
5860

5961
.. code-block:: shell
6062
61-
# make sure you activate the venv using "source venv/bin/activate" first
62-
maturin develop
63+
# make sure you activate the venv using "source .venv/bin/activate" first
64+
maturin develop -uv
6365
python -m pytest
6466
6567
Running & Installing pre-commit hooks
@@ -86,20 +88,10 @@ Mostly, the ``python`` code is limited to pure wrappers with type hints and good
8688
Update Dependencies
8789
-------------------
8890

89-
To change test dependencies, change the `requirements.in` and run
90-
91-
.. code-block:: shell
92-
93-
# install pip-tools (this can be done only once), also consider running in venv
94-
python -m pip install pip-tools
95-
python -m piptools compile --generate-hashes -o requirements-310.txt
91+
To change test dependencies, change the ``pyproject.toml`` and run
9692

97-
98-
To update dependencies, run with `-U`
93+
To update dependencies, run
9994

10095
.. code-block:: shell
10196
102-
python -m piptools compile -U --generate-hashes -o requirements-310.txt
103-
104-
105-
More details about pip-tools `here <https://github.com/jazzband/pip-tools>`_
97+
uv sync --dev --no-install-package datafusion

0 commit comments

Comments
 (0)