Skip to content

Commit c21e90c

Browse files
authored
Add Jupyter release workflow and align workflow filenames (#189)
1 parent 06f532f commit c21e90c

5 files changed

Lines changed: 266 additions & 38 deletions

File tree

Lines changed: 218 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,218 @@
1+
name: Jupyter Kernel Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
generate:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- uses: actions/setup-node@v4
19+
with:
20+
node-version: "20"
21+
22+
- name: Install tree-sitter-cli
23+
run: npm install -g tree-sitter-cli
24+
25+
- name: Generate parser
26+
working-directory: tree-sitter-ggsql
27+
run: tree-sitter generate
28+
29+
- uses: actions/upload-artifact@v4
30+
with:
31+
name: tree-sitter-generated
32+
path: tree-sitter-ggsql/src/
33+
34+
linux:
35+
needs: generate
36+
runs-on: ubuntu-latest
37+
strategy:
38+
matrix:
39+
target: [x86_64, aarch64]
40+
env:
41+
GGSQL_SKIP_GENERATE: "1"
42+
steps:
43+
- uses: actions/checkout@v4
44+
45+
- uses: actions/download-artifact@v4
46+
with:
47+
name: tree-sitter-generated
48+
path: tree-sitter-ggsql/src/
49+
50+
- name: Build wheels
51+
uses: PyO3/maturin-action@v1
52+
with:
53+
target: ${{ matrix.target }}
54+
args: --release --out dist
55+
working-directory: ggsql-jupyter
56+
manylinux: 2_28
57+
docker-options: -e GGSQL_SKIP_GENERATE=1
58+
59+
- uses: actions/upload-artifact@v4
60+
with:
61+
name: jupyter-wheels-linux-${{ matrix.target }}
62+
path: ggsql-jupyter/dist
63+
64+
macos:
65+
needs: generate
66+
runs-on: ${{ matrix.runner }}
67+
strategy:
68+
matrix:
69+
include:
70+
- target: x86_64
71+
runner: macos-latest
72+
- target: aarch64
73+
runner: macos-latest
74+
env:
75+
GGSQL_SKIP_GENERATE: "1"
76+
steps:
77+
- uses: actions/checkout@v4
78+
79+
- uses: actions/download-artifact@v4
80+
with:
81+
name: tree-sitter-generated
82+
path: tree-sitter-ggsql/src/
83+
84+
- name: Build wheels
85+
uses: PyO3/maturin-action@v1
86+
with:
87+
target: ${{ matrix.target }}
88+
args: --release --out dist
89+
working-directory: ggsql-jupyter
90+
91+
- uses: actions/upload-artifact@v4
92+
with:
93+
name: jupyter-wheels-macos-${{ matrix.target }}
94+
path: ggsql-jupyter/dist
95+
96+
windows:
97+
needs: generate
98+
runs-on: windows-latest
99+
env:
100+
GGSQL_SKIP_GENERATE: "1"
101+
steps:
102+
- uses: actions/checkout@v4
103+
104+
- uses: actions/download-artifact@v4
105+
with:
106+
name: tree-sitter-generated
107+
path: tree-sitter-ggsql/src/
108+
109+
- name: Build wheels
110+
uses: PyO3/maturin-action@v1
111+
with:
112+
target: x64
113+
args: --release --out dist
114+
working-directory: ggsql-jupyter
115+
116+
- uses: actions/upload-artifact@v4
117+
with:
118+
name: jupyter-wheels-windows-x64
119+
path: ggsql-jupyter/dist
120+
121+
sdist:
122+
needs: generate
123+
runs-on: ubuntu-latest
124+
env:
125+
GGSQL_SKIP_GENERATE: "1"
126+
steps:
127+
- uses: actions/checkout@v4
128+
129+
- uses: actions/download-artifact@v4
130+
with:
131+
name: tree-sitter-generated
132+
path: tree-sitter-ggsql/src/
133+
134+
- name: Build sdist
135+
uses: PyO3/maturin-action@v1
136+
with:
137+
command: sdist
138+
args: --out dist
139+
working-directory: ggsql-jupyter
140+
141+
- uses: actions/upload-artifact@v4
142+
with:
143+
name: jupyter-wheels-sdist
144+
path: ggsql-jupyter/dist
145+
146+
publish:
147+
needs: [linux, macos, windows, sdist]
148+
runs-on: ubuntu-latest
149+
if: startsWith(github.ref, 'refs/tags/')
150+
environment: pypi-jupyter
151+
permissions:
152+
id-token: write
153+
steps:
154+
- uses: actions/download-artifact@v4
155+
with:
156+
pattern: jupyter-wheels-*
157+
merge-multiple: true
158+
path: dist
159+
160+
- name: List wheels
161+
run: ls -lh dist/
162+
163+
- name: Publish to PyPI
164+
uses: pypa/gh-action-pypi-publish@release/v1
165+
166+
github-release:
167+
needs: [linux, macos, windows]
168+
runs-on: ubuntu-latest
169+
if: startsWith(github.ref, 'refs/tags/')
170+
permissions:
171+
contents: write
172+
steps:
173+
- uses: actions/download-artifact@v4
174+
with:
175+
pattern: jupyter-wheels-*
176+
path: artifacts
177+
178+
- name: Extract binaries from wheels
179+
run: |
180+
mkdir -p binaries
181+
182+
# Linux x86_64
183+
unzip -j artifacts/jupyter-wheels-linux-x86_64/*manylinux*x86_64*.whl \
184+
"*.data/scripts/ggsql-jupyter" -d /tmp/extract
185+
mv /tmp/extract/ggsql-jupyter binaries/ggsql-jupyter-linux-x64
186+
rm -rf /tmp/extract
187+
188+
# Linux aarch64
189+
unzip -j artifacts/jupyter-wheels-linux-aarch64/*manylinux*aarch64*.whl \
190+
"*.data/scripts/ggsql-jupyter" -d /tmp/extract
191+
mv /tmp/extract/ggsql-jupyter binaries/ggsql-jupyter-linux-arm64
192+
rm -rf /tmp/extract
193+
194+
# macOS x86_64
195+
unzip -j artifacts/jupyter-wheels-macos-x86_64/*macosx*x86_64*.whl \
196+
"*.data/scripts/ggsql-jupyter" -d /tmp/extract
197+
mv /tmp/extract/ggsql-jupyter binaries/ggsql-jupyter-macos-x64
198+
rm -rf /tmp/extract
199+
200+
# macOS aarch64
201+
unzip -j artifacts/jupyter-wheels-macos-aarch64/*macosx*arm64*.whl \
202+
"*.data/scripts/ggsql-jupyter" -d /tmp/extract
203+
mv /tmp/extract/ggsql-jupyter binaries/ggsql-jupyter-macos-arm64
204+
rm -rf /tmp/extract
205+
206+
# Windows x64
207+
unzip -j artifacts/jupyter-wheels-windows-x64/*win_amd64*.whl \
208+
"*.data/scripts/ggsql-jupyter.exe" -d /tmp/extract
209+
mv /tmp/extract/ggsql-jupyter.exe binaries/ggsql-jupyter-windows-x64.exe
210+
rm -rf /tmp/extract
211+
212+
chmod +x binaries/ggsql-jupyter-*
213+
ls -lh binaries/
214+
215+
- name: Upload to GitHub Release
216+
uses: softprops/action-gh-release@v2
217+
with:
218+
files: binaries/*

ggsql-jupyter/README.md

Lines changed: 30 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -19,63 +19,55 @@ The ggsql Jupyter kernel enables you to run ggsql queries directly in Jupyter no
1919
### Prerequisites
2020

2121
- Jupyter Lab or Notebook installed
22-
- Python 3.8+ (for Jupyter)
2322

24-
### Option 1: Install from crates.io (Recommended)
23+
### Option 1: Install from PyPI (Recommended)
2524

26-
If you have Rust installed:
25+
The easiest way to install the ggsql kernel is from PyPI. This provides pre-built binaries for Linux, macOS, and Windows.
26+
27+
Using pip:
2728

2829
```bash
29-
cargo install ggsql-jupyter
30+
pip install ggsql-jupyter
3031
ggsql-jupyter --install
3132
```
3233

33-
This will:
34-
35-
1. Download and compile the kernel
36-
2. Install it into your current environment (respects virtualenvs, conda, uv)
37-
38-
### Option 2: Download Pre-built Binary from GitHub Releases
34+
Using [uv](https://docs.astral.sh/uv/):
3935

40-
For users without Rust:
41-
42-
1. **Download the binary** for your platform from [GitHub Releases](https://github.com/georgestagg/ggsql/releases)
43-
44-
- Linux: `ggsql-jupyter-linux-x64`
45-
- macOS (Intel): `ggsql-jupyter-macos-x64`
46-
- macOS (Apple Silicon): `ggsql-jupyter-macos-arm64`
47-
- Windows: `ggsql-jupyter-windows-x64.exe`
36+
```bash
37+
uv tool install ggsql-jupyter
38+
ggsql-jupyter --install
39+
```
4840

49-
2. **Rename and make executable** (Linux/macOS):
41+
The `--install` flag registers the kernel with Jupyter. It automatically detects and respects your current environment (virtualenv, conda, uv, etc.).
5042

51-
```bash
52-
mv ggsql-jupyter-linux-x64 ggsql-jupyter
53-
chmod +x ggsql-jupyter
54-
```
43+
### Option 2: Download Pre-built Binary
5544

56-
3. **Install the kernel**:
45+
Pre-built binaries are available from [GitHub Releases](https://github.com/georgestagg/ggsql/releases):
5746

58-
```bash
59-
./ggsql-jupyter --install
60-
```
47+
| Platform | Binary |
48+
| -------------------- | ---------------------------------- |
49+
| Linux (x86_64) | `ggsql-jupyter-linux-x64` |
50+
| Linux (ARM64) | `ggsql-jupyter-linux-arm64` |
51+
| macOS (Intel) | `ggsql-jupyter-macos-x64` |
52+
| macOS (Apple Silicon) | `ggsql-jupyter-macos-arm64` |
53+
| Windows (x64) | `ggsql-jupyter-windows-x64.exe` |
6154

62-
On Windows (PowerShell):
55+
After downloading, make it executable and install:
6356

64-
```powershell
65-
.\ggsql-jupyter-windows-x64.exe --install
66-
```
57+
```bash
58+
chmod +x ggsql-jupyter-*
59+
./ggsql-jupyter-linux-x64 --install
60+
```
6761

68-
The `--install` flag automatically:
62+
On Windows (PowerShell):
6963

70-
- Creates a temporary directory with the kernel spec
71-
- Copies the binary to the appropriate location
72-
- Runs `jupyter kernelspec install` with the correct flags
73-
- Respects your current environment (virtualenv, conda, etc.)
74-
- Cleans up temporary files
64+
```powershell
65+
.\ggsql-jupyter-windows-x64.exe --install
66+
```
7567

7668
### Option 3: Build from Source
7769

78-
From the workspace root:
70+
Requires a [Rust toolchain](https://rustup.rs/). From the workspace root:
7971

8072
```bash
8173
cargo build --release --package ggsql-jupyter

ggsql-jupyter/pyproject.toml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[build-system]
2+
requires = ["maturin>=1.4"]
3+
build-backend = "maturin"
4+
5+
[project]
6+
name = "ggsql-jupyter"
7+
version = "0.1.0"
8+
description = "Jupyter kernel for ggsql - SQL extension for declarative data visualization"
9+
readme = "README.md"
10+
license = { text = "MIT" }
11+
keywords = ["jupyter", "kernel", "sql", "visualization", "ggsql"]
12+
classifiers = [
13+
"Programming Language :: Rust",
14+
"Framework :: Jupyter",
15+
]
16+
17+
[tool.maturin]
18+
bindings = "bin"

0 commit comments

Comments
 (0)