Skip to content

Commit 8aa2a78

Browse files
tokokonielspardon
andauthored
chore: use pixi for codegen environment in ci (#137)
Co-authored-by: Niels Pardon <[email protected]>
1 parent ec14cc8 commit 8aa2a78

File tree

14 files changed

+4889
-487
lines changed

14 files changed

+4889
-487
lines changed

.devcontainer/Dockerfile

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
FROM mcr.microsoft.com/vscode/devcontainers/python:3.13
22
USER vscode
3-
RUN curl -s "https://get.sdkman.io" | bash
4-
RUN bash -c "source $HOME/.sdkman/bin/sdkman-init.sh && \
5-
sdk install java 25-graalce"
6-
RUN mkdir -p ~/lib && cd ~/lib && curl -L -O http://www.antlr.org/download/antlr-4.13.2-complete.jar
7-
ENV ANTLR_JAR="~/lib/antlr-4.13.2-complete.jar"
8-
RUN cd ~ && curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v33.2/protoc-33.2-linux-x86_64.zip && \
9-
unzip protoc-33.2-linux-x86_64.zip -d ~/.local && \
10-
rm protoc-33.2-linux-x86_64.zip
11-
RUN curl -sSL "https://github.com/bufbuild/buf/releases/download/v1.58.0/buf-$(uname -s)-$(uname -m)" -o ~/.local/bin/buf && chmod +x ~/.local/bin/buf
123
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
13-
USER root
4+
RUN curl -fsSL https://pixi.sh/install.sh | sh
5+
ENV PATH=~/.pixi/bin:$PATH

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
// "forwardPorts": [],
1515

1616
// Use 'postCreateCommand' to run commands after the container is created.
17-
"postCreateCommand": "uv venv --clear && uv sync --group gen_proto",
17+
"postCreateCommand": "uv venv --clear && uv sync",
1818

1919
// Configure tool-specific properties.
2020
"customizations": {

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
src/substrait/gen/** linguist-generated=true
22
src/substrait/extensions/** linguist-generated=true
3+
# SCM syntax highlighting & preventing 3-way merges
4+
pixi.lock merge=binary linguist-language=YAML linguist-generated=true -diff

.github/workflows/codegen-check.yml

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,17 @@ jobs:
1616
with:
1717
submodules: recursive
1818

19-
- name: Run code generation in devcontainer
20-
uses: devcontainers/[email protected]
19+
- uses: prefix-dev/[email protected]
2120
with:
22-
runCmd: |
23-
# fetch submodule tags since actions/checkout does not
24-
git submodule foreach 'git fetch --unshallow || true'
25-
# Run all code generation steps
26-
make codegen
21+
pixi-version: v0.62.2
22+
23+
- name: Run code generation
24+
run: |
25+
# fetch submodule tags since actions/checkout does not
26+
git submodule foreach 'git fetch --unshallow || true'
27+
# Run all code generation steps
28+
pixi run codegen
2729
2830
- name: Check for uncommitted changes
2931
run: |
30-
# Check for diffs, ignoring timestamp lines
31-
if ! git diff --quiet --exit-code src/substrait/gen/; then
32-
echo "Code generation produced changes. Generated code is out of sync!"
33-
echo ""
34-
git diff src/substrait/gen/
35-
echo ""
36-
echo "To fix this, run:"
37-
echo " make codegen"
38-
echo "Then commit the changes."
39-
exit 1
40-
fi
32+
pixi run check-codegen

.github/workflows/ruff.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,18 @@ jobs:
1515
strategy:
1616
matrix:
1717
os: [ubuntu-latest]
18-
python: ["3.10"]
1918
runs-on: ${{ matrix.os }}
2019
steps:
2120
- name: Checkout code
2221
uses: actions/checkout@v6
2322
with:
2423
submodules: recursive
25-
- name: Install uv with python
26-
uses: astral-sh/setup-uv@v7
24+
- uses: prefix-dev/[email protected]
2725
with:
28-
python-version: ${{ matrix.python }}
26+
pixi-version: v0.62.2
2927
- name: Run ruff linter
3028
run: |
31-
29+
pixi run lint
3230
- name: Run ruff formatter
3331
run: |
34-
uvx [email protected] format --check
32+
pixi run format --check

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,6 @@ src/substrait/_version.py
142142
.directory
143143
.gdb_history
144144
.DS_Store
145+
# pixi environments
146+
.pixi/*
147+
!.pixi/config.toml

CONTRIBUTING.md

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,58 +13,61 @@ uv sync --extra test
1313
```
1414

1515
## Update the substrait submodule locally
16+
You can run update-submodule task to pull in latest substrait from upstream.
17+
```
18+
pixi run update-submodule <version>
19+
```
20+
21+
Or you can update submodule and run code generation at the same time with
22+
```
23+
pixi run update-substrait
24+
```
25+
1626
This might be necessary if you are updating an existing checkout.
1727
```
1828
git submodule sync --recursive
1929
git submodule update --init --recursive
2030
```
2131

22-
2332
# Code generation
2433

25-
You can run the full code generation using the following command or use the individual commands to selectively regenerate the generated code. This does not update the Substrait Git submodule.
34+
You can run the full code generation using the following command or use the individual commands to selectively regenerate the generated code. This does not update the Substrait Git submodule. You can use pixi environment defined in pyproject.toml which contains all dependencies needed for code generation.
2635

2736
```
28-
make codegen
37+
pixi run codegen
2938
```
3039

3140
## Protobuf stubs
3241

33-
Run the upgrade script to upgrade the submodule and regenerate the protobuf stubs.
34-
35-
```
36-
uv run --group gen_proto ./update_proto.sh <version>
37-
```
38-
39-
Or run the proto codegen without updating the Substrait Git submodule:
42+
Run the proto codegen only:
4043

4144
```
42-
make codegen-proto
45+
pixi run codegen-proto
4346
```
4447

4548
## Antlr grammar
4649

4750
Substrait uses antlr grammar to derive output types of extension functions. Make sure java is installed and ANTLR_JAR environment variable is set. Take a look at .devcontainer/Dockerfile for example setup.
4851

4952
```
50-
make antlr
53+
pixi run antlr
5154
```
5255

5356
## Extensions stubs
5457

5558
Substrait uses jsonschema to describe the data model for extension files.
5659

5760
```
58-
make codegen-extensions
61+
pixi run codegen-extensions
5962
```
6063

6164
# Lint & Format
6265

63-
Run the following make commands to lint and format with ruff.
66+
Run the following pixi tasks to lint and format with ruff.
6467

6568
```
66-
make lint
67-
make format
69+
pixi run lint
70+
pixi run format
6871
```
6972

7073
# Test

Makefile

Lines changed: 0 additions & 34 deletions
This file was deleted.

check_codegen.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
if ! git diff --quiet --exit-code src/substrait/gen/; then
3+
echo "Code generation produced changes. Generated code is out of sync!"
4+
echo ""
5+
git diff src/substrait/gen/
6+
echo ""
7+
echo "To fix this, run:"
8+
echo " pixi run codegen"
9+
echo "Then commit the changes."
10+
exit 1
11+
fi

0 commit comments

Comments
 (0)