Skip to content

Commit f9e2ea4

Browse files
authored
simplify upstream dependencies to avoid resolution errors (#1429)
* simplify upstream dependecies to avoid resolution errors * move to use dependency groups - PEP 753 * more docs * fix doc build * fix docs build for real * fix upstream not installing mypy * upstream workflow will report failures to install
1 parent a61c211 commit f9e2ea4

File tree

8 files changed

+171
-100
lines changed

8 files changed

+171
-100
lines changed

.github/setup-failure-template.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Nightly Upstream Dependency Installation Failed
2+
3+
**Workflow:** {{WORKFLOW}}
4+
**Run:** [{{RUN_ID}}]({{RUN_URL}})
5+
**Date:** {{DATE}}
6+
7+
## Issue
8+
9+
The upstream dependency installation step failed during the nightly CI run.
10+
11+
This likely indicates an issue with:
12+
- The nightly wheels repository
13+
- Dependency resolution conflicts
14+
- Version incompatibilities between upstream packages
15+
16+
## Setup Output
17+
18+
```
19+
{{SETUP_OUTPUT}}
20+
```
21+
22+
This issue was automatically generated from the nightly upstream dependency checks.

.github/workflows/python-check.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ jobs:
9999
python --version
100100
PYTHON_TAG="cp$(echo ${{ env.PYTHON_VERSION }} | tr -d '.')"
101101
WHEEL=$(ls dist/*-${PYTHON_TAG}-*.whl)
102-
uv pip install "${WHEEL}[test]"
102+
uv pip install "$WHEEL" --group test
103103
# Install specific versions based on matrix
104104
if [ "${{ matrix.deps-version.name }}" = "minimum" ]; then
105105
echo "Installing minimum versions:"
@@ -186,7 +186,7 @@ jobs:
186186
python --version
187187
PYTHON_TAG="cp$(echo ${{ env.PYTHON_VERSION }} | tr -d '.')"
188188
WHEEL=$(ls dist/*-${PYTHON_TAG}-*.whl)
189-
uv pip install "${WHEEL}[test]"
189+
uv pip install "$WHEEL" --group test
190190
uv pip install pytest-mypy-plugins
191191
# Install specific xarray version based on matrix
192192
if [ "${{ matrix.xarray-version.version }}" != "latest-release" ]; then

.github/workflows/python-upstream.yaml

Lines changed: 56 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,19 +72,67 @@ jobs:
7272
# manylinux: ${{ matrix.platform.manylinux }} # https://github.com/PyO3/maturin-action/issues/245
7373

7474
- name: setup
75+
id: setup
7576
shell: bash
7677
working-directory: icechunk-python
7778
run: |
7879
set -e
7980
python3 -m venv .venv
8081
source .venv/bin/activate
8182
python --version
82-
uv pip install --group upstream --pre
8383
PY_TAG="cp${PYTHON_VERSION//./}"
8484
WHEEL=$(ls dist/*-${PY_TAG}-*.whl)
85-
uv pip install "$WHEEL" --no-deps --force-reinstall
85+
# Install upstream dependencies from nightly wheels
86+
export UV_INDEX="https://pypi.anaconda.org/scientific-python-nightly-wheels/simple/"
87+
export UV_PRERELEASE=allow
88+
uv pip install "$WHEEL" --group dev \
89+
--resolution highest \
90+
--index-strategy unsafe-best-match 2>&1 | tee setup-output.log
8691
uv pip list
8792
93+
- name: Create or update setup failure issue
94+
if: |
95+
always()
96+
&& steps.setup.outcome == 'failure'
97+
&& github.event_name == 'schedule'
98+
&& github.repository_owner == 'earth-mover'
99+
shell: bash
100+
working-directory: .
101+
run: |
102+
# Read the template and setup output
103+
template=$(cat .github/setup-failure-template.md)
104+
105+
setup_output="No setup output captured"
106+
if [ -f "icechunk-python/setup-output.log" ]; then
107+
setup_output=$(cat icechunk-python/setup-output.log)
108+
fi
109+
110+
# Replace placeholders
111+
issue_body="${template//\{\{WORKFLOW\}\}/${{ github.workflow }}}"
112+
issue_body="${issue_body//\{\{RUN_ID\}\}/${{ github.run_id }}}"
113+
issue_body="${issue_body//\{\{RUN_URL\}\}/${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}}"
114+
issue_body="${issue_body//\{\{DATE\}\}/$(date -u)}"
115+
issue_body="${issue_body//\{\{SETUP_OUTPUT\}\}/$setup_output}"
116+
117+
# Check for existing open issue with same title
118+
issue_title="Nightly upstream dependency installation failed"
119+
existing_issue=$(gh issue list --state open --label "CI" --search "\"$issue_title\" in:title" --json number --jq '.[0].number // empty')
120+
121+
if [ -n "$existing_issue" ]; then
122+
echo "Found existing open issue #$existing_issue, updating it..."
123+
echo "$issue_body" | gh issue edit "$existing_issue" --body-file -
124+
echo "Updated existing issue #$existing_issue"
125+
else
126+
echo "No existing open issue found, creating new one..."
127+
echo "$issue_body" | gh issue create \
128+
--title "$issue_title" \
129+
--body-file - \
130+
--label "CI"
131+
echo "Created new issue"
132+
fi
133+
env:
134+
GH_TOKEN: ${{ github.token }}
135+
88136
- name: mypy
89137
id: mypy
90138
shell: bash
@@ -232,8 +280,12 @@ jobs:
232280
python --version
233281
PY_TAG="cp${PYTHON_VERSION//./}"
234282
WHEEL=$(ls dist/*-${PY_TAG}-*.whl)
235-
uv pip install "$WHEEL" --group upstream
236-
uv pip install pytest-mypy-plugins
283+
# Install upstream dependencies from nightly wheels
284+
export UV_INDEX="https://pypi.anaconda.org/scientific-python-nightly-wheels/simple/"
285+
export UV_PRERELEASE=allow
286+
uv pip install "$WHEEL" --group test pytest-mypy-plugins \
287+
--resolution highest \
288+
--index-strategy unsafe-best-match
237289
uv pip list
238290
239291
- name: Stand up MinIO

docs/.readthedocs.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@ build:
66
python: "mambaforge-latest"
77

88
jobs:
9-
install:
9+
install:
1010
- which mamba
11-
- cd icechunk-python && maturin build && pip install "$(ls ../target/wheels/*.whl | head -n 1)[docs]" && cd ../docs
11+
- cd icechunk-python && maturin build && pip install "$(ls ../target/wheels/*.whl | head -n 1)" && pip install --group docs && cd ../docs
1212
- mamba list
1313
# - cd icechunk-python && maturin develop && cd ../docs
1414

15-
1615
conda:
1716
environment: docs/doc-env.yml
1817
mkdocs:

docs/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ From the `icechunk-python` directory:
2222

2323
```bash
2424
# Install icechunk with docs dependencies
25-
uv sync --extra docs
25+
uv sync --group docs
2626

2727
# Start the MkDocs development server
2828
cd ../docs
@@ -42,7 +42,6 @@ uv run mkdocs build
4242

4343
Builds output to: `docs/.site` directory.
4444

45-
4645
### Deploying
4746

4847
Docs are automatically deployed upon commits to `main` branch via readthedocs

docs/docs/contributing.md

Lines changed: 50 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -23,66 +23,53 @@ The Python code is developed in the `icechunk-python` subdirectory. To make chan
2323
cd icechunk-python
2424
```
2525

26-
Create / activate a virtual environment:
26+
#### Setting up your development environment
2727

28-
=== "Venv"
28+
=== "uv (Recommended)"
2929

30-
```bash
31-
python3 -m venv .venv
32-
source .venv/bin/activate
33-
```
34-
35-
=== "Conda / Mamba"
36-
37-
```bash
38-
mamba create -n icechunk python=3.12 rust zarr
39-
mamba activate icechunk
40-
```
41-
42-
=== "uv"
30+
The easiest way to get started is with [uv](https://docs.astral.sh/uv/), which handles virtual environments, dependencies, and building automatically:
4331

4432
```bash
33+
# Install all development dependencies (includes test dependencies, mypy, ruff, maturin)
4534
uv sync
35+
36+
# Activate the virtual environment
4637
source .venv/bin/activate
47-
```
4838

49-
Install `maturin`:
39+
# Run tests
40+
uv run pytest
5041

51-
=== "Venv"
42+
# Run type checking
43+
uv run mypy python
5244

53-
```bash
54-
pip install maturin
45+
# Run linting
46+
uv run ruff check python
5547
```
56-
57-
Build the project in dev mode:
58-
59-
```bash
60-
maturin develop
61-
62-
# or with the optional dependencies
63-
maturin develop --extras=test,benchmark
64-
```
65-
66-
or build the project in editable mode:
48+
=== "Venv"
6749

6850
```bash
69-
pip install -e .
70-
```
51+
python3 -m venv .venv
52+
source .venv/bin/activate
7153

72-
=== "uv"
54+
# Install maturin and dependencies
55+
pip install maturin
56+
pip install --group dev
7357

74-
uv manages rebuilding as needed, so it will run the Maturin build when using `uv run`.
58+
# Build the Rust extension
59+
maturin develop
7560

76-
To explicitly use Maturin, install it globally.
61+
=== "Conda / Mamba"
7762

7863
```bash
79-
uv tool install maturin
80-
```
64+
mamba create -n icechunk python=3.12 rust zarr
65+
mamba activate icechunk
8166

82-
Maturin may need to know it should work with uv, so add `--uv` to the CLI.
67+
# Install maturin and dependencies
68+
pip install maturin
69+
pip install --group dev
8370

84-
```bash
85-
maturin develop --uv --extras=test,benchmark
71+
# Build the Rust extension
72+
maturin develop
8673
```
8774

8875
#### Testing
@@ -96,6 +83,27 @@ They can be run from the root of the repo with `docker compose up` (`ctrl-c` the
9683
```bash
9784
uv run pytest
9885
```
86+
=== "Venv/Conda"
87+
88+
```bash
89+
pytest
90+
```
91+
92+
#### Testing with Upstream Dependencies
93+
94+
To test Icechunk against development versions of upstream packages (zarr, xarray, dask, distributed), use the nightly wheels from the scientific-python-nightly-wheels repository:
95+
96+
```bash
97+
# Install with nightly wheels
98+
export UV_INDEX="https://pypi.anaconda.org/scientific-python-nightly-wheels/simple/"
99+
export UV_PRERELEASE=allow
100+
uv sync --group test \
101+
--resolution highest \
102+
--index-strategy unsafe-best-match
103+
104+
# Run tests
105+
uv run pytest
106+
```
99107

100108
#### Running Xarray Backend Tests
101109

@@ -191,7 +199,7 @@ From the `icechunk-python` directory:
191199

192200
```bash
193201
# Install icechunk with docs dependencies
194-
uv sync --extra docs
202+
uv sync --group docs
195203

196204
# Start the MkDocs development server
197205
cd ../docs

icechunk-python/README.md

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,50 @@ Python library for Icechunk Zarr Stores
44

55
## Getting Started
66

7-
Activate the virtual environment:
7+
### For Development
8+
9+
The recommended way to set up for development is with [uv](https://docs.astral.sh/uv/):
810

911
```bash
10-
python3 -m venv .venv
12+
# Install all development dependencies (test, mypy, ruff, maturin)
13+
uv sync
14+
15+
# Activate the virtual environment
1116
source .venv/bin/activate
17+
18+
# Run tests
19+
uv run pytest
20+
21+
# Run type checking
22+
uv run mypy python
23+
24+
# Run linting
25+
uv run ruff check python
1226
```
1327

14-
Install `maturin`:
28+
uv automatically rebuilds the Rust extension as needed when you run commands with `uv run`.
29+
30+
### Alternative: Manual Setup with pip
31+
32+
If not using uv:
1533

1634
```bash
35+
python3 -m venv .venv
36+
source .venv/bin/activate
37+
38+
# Install maturin
1739
pip install maturin
18-
```
1940

20-
Build the project in dev mode:
41+
# Install dev dependencies (includes test, mypy, ruff)
42+
pip install --group dev
2143

22-
```bash
44+
# Build the Rust extension
2345
maturin develop
2446
```
2547

26-
or build the project in editable mode:
27-
28-
```bash
29-
pip install -e .
30-
```
48+
Note: Modern pip (>=21.3) supports dependency groups. If you have an older pip, upgrade with `pip install --upgrade pip`. When the Rust code changes, re-run `maturin develop` to rebuild.
3149

32-
**Note**: This only makes the python source code editable, the rust will need to be recompiled when it changes
50+
**Note**: When using editable mode, only the Python source code is editable; the Rust code will need to be recompiled when it changes.
3351

3452
Now you can create or open an icechunk store for use with `zarr-python`:
3553

0 commit comments

Comments
 (0)