Skip to content

Commit 9d47c81

Browse files
authored
Merge branch 'main' into buckets
2 parents b692cb9 + d781303 commit 9d47c81

12 files changed

Lines changed: 388 additions & 70 deletions

File tree

.changeset/stale-groups-hug.md

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: PR wheel preview build
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
7+
concurrency:
8+
group: pr-wheel-build-${{ github.event.pull_request.number }}-${{ github.head_ref || github.run_id }}
9+
cancel-in-progress: true
10+
11+
permissions: {}
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
18+
pull-requests: read
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- uses: actions/setup-python@v4
23+
with:
24+
python-version: "3.10"
25+
26+
- uses: actions/setup-node@v4
27+
with:
28+
node-version: "20"
29+
cache: npm
30+
cache-dependency-path: trackio/frontend/package-lock.json
31+
32+
- name: Build frontend
33+
run: |
34+
cd trackio/frontend
35+
npm ci
36+
npm run build
37+
38+
- name: Install build
39+
run: python -m pip install build
40+
41+
- name: Build wheel
42+
env:
43+
SKIP_FRONTEND_BUILD: "1"
44+
run: python -m build -w
45+
46+
- name: Write metadata
47+
run: |
48+
python3 << 'PY'
49+
import json
50+
from pathlib import Path
51+
52+
wheels = sorted(Path("dist").glob("trackio-*.whl"))
53+
if len(wheels) != 1:
54+
raise SystemExit(f"expected one trackio wheel, got {[p.name for p in wheels]}")
55+
meta = {
56+
"pr_number": ${{ github.event.pull_request.number }},
57+
"sha": "${{ github.event.pull_request.head.sha }}",
58+
"wheel_basename": wheels[0].name,
59+
}
60+
Path("output.json").write_text(json.dumps(meta))
61+
PY
62+
63+
- name: Upload wheel
64+
uses: actions/upload-artifact@v4
65+
with:
66+
name: trackio-wheel
67+
path: dist/*.whl
68+
69+
- name: Upload metadata
70+
uses: actions/upload-artifact@v4
71+
with:
72+
name: pr-wheel-preview-metadata
73+
path: output.json
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: PR wheel preview deploy
2+
3+
on:
4+
workflow_run:
5+
workflows: ["PR wheel preview build"]
6+
types:
7+
- completed
8+
9+
concurrency:
10+
group: pr-wheel-deploy-${{ github.event.workflow_run.head_sha }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
deploy:
15+
if: github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request'
16+
runs-on: ubuntu-latest
17+
permissions:
18+
actions: read
19+
outputs:
20+
pr_number: ${{ steps.meta.outputs.pr_number }}
21+
sha: ${{ steps.meta.outputs.sha }}
22+
wheel_basename: ${{ steps.meta.outputs.wheel_basename }}
23+
steps:
24+
- name: Download metadata
25+
uses: actions/download-artifact@v4
26+
with:
27+
name: pr-wheel-preview-metadata
28+
path: metadata
29+
github-token: ${{ secrets.GITHUB_TOKEN }}
30+
repository: ${{ github.repository }}
31+
run-id: ${{ github.event.workflow_run.id }}
32+
33+
- name: Download wheel
34+
uses: actions/download-artifact@v4
35+
with:
36+
name: trackio-wheel
37+
path: wheel
38+
github-token: ${{ secrets.GITHUB_TOKEN }}
39+
repository: ${{ github.repository }}
40+
run-id: ${{ github.event.workflow_run.id }}
41+
42+
- name: Parse metadata
43+
id: meta
44+
run: |
45+
echo "pr_number=$(jq -r .pr_number metadata/output.json)" >> $GITHUB_OUTPUT
46+
echo "sha=$(jq -r .sha metadata/output.json)" >> $GITHUB_OUTPUT
47+
echo "wheel_basename=$(jq -r .wheel_basename metadata/output.json)" >> $GITHUB_OUTPUT
48+
49+
- name: Install hf CLI
50+
run: curl -LsSf https://hf.co/cli/install.sh | bash
51+
52+
- name: Upload wheel to Hugging Face bucket
53+
env:
54+
HF_TOKEN: ${{ secrets.HF_PYPI_PREVIEWS_TOKEN }}
55+
run: |
56+
echo "$HOME/.local/bin" >> $GITHUB_PATH
57+
wheel_file=$(find wheel -maxdepth 1 -type f -name "*.whl" -print -quit)
58+
hf buckets cp "$wheel_file" "hf://buckets/trackio/trackio-wheels/${{ steps.meta.outputs.sha }}/"
59+
60+
comment:
61+
needs: deploy
62+
if: needs.deploy.result == 'success'
63+
uses: ./.github/workflows/comment-queue.yml
64+
secrets:
65+
gh_token: ${{ secrets.COMMENT_BOT_TOKEN }}
66+
with:
67+
pr_number: ${{ needs.deploy.outputs.pr_number }}
68+
tag: trackio-pr-wheel
69+
message: trackio-wheel~success~null
70+
additional_text: |
71+
**Install Trackio from this PR (includes built frontend)**
72+
73+
```bash
74+
pip install "https://huggingface.co/buckets/trackio/trackio-wheels/resolve/${{ needs.deploy.outputs.sha }}/${{ needs.deploy.outputs.wheel_basename }}"
75+
```

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# trackio
22

3+
## 0.20.2
4+
5+
### Features
6+
7+
- [#464](https://github.com/gradio-app/trackio/pull/464) [`c89ebb3`](https://github.com/gradio-app/trackio/commit/c89ebb3b50f695bc7f16cbc6f46dce86f79a01e9) - Improve rendering of curves. Thanks @abidlabs!
8+
- [#462](https://github.com/gradio-app/trackio/pull/462) [`9160b78`](https://github.com/gradio-app/trackio/commit/9160b78ff6f258f0b87a4f34a24e7d0b5dfbf2fb) - Refactor plot title to display only the metric name without the path. Thanks @qgallouedec!
9+
310
## 0.20.1
411

512
### Features

tests/ui/test_ui_display.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ def test_multiple_runs_display_multiple_plots(temp_dir):
180180
plots = page.locator(".vega-embed")
181181
expect(plots).to_have_count(3)
182182

183-
line_marks = page.locator(".vega-embed .mark-line.role-mark")
184-
expect(line_marks.first).to_be_visible()
183+
canvases = page.locator(".vega-embed canvas")
184+
expect(canvases.first).to_be_visible()
185185

186186
bar_plots = page.locator(".bar-plot")
187187
expect(bar_plots).to_have_count(1)

trackio/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# trackio
22

3+
## 0.20.2
4+
5+
### Features
6+
7+
- [#464](https://github.com/gradio-app/trackio/pull/464) [`c89ebb3`](https://github.com/gradio-app/trackio/commit/c89ebb3b50f695bc7f16cbc6f46dce86f79a01e9) - Improve rendering of curves. Thanks @abidlabs!
8+
- [#462](https://github.com/gradio-app/trackio/pull/462) [`9160b78`](https://github.com/gradio-app/trackio/commit/9160b78ff6f258f0b87a4f34a24e7d0b5dfbf2fb) - Refactor plot title to display only the metric name without the path. Thanks @qgallouedec!
9+
310
## 0.20.1
411

512
### Features

trackio/frontend/src/components/BarPlot.svelte

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script>
22
import { onMount, tick } from "svelte";
33
import embed from "vega-embed";
4+
import { buildColorSpecKey } from "../lib/dataProcessing.js";
45
56
let {
67
data = [],
@@ -34,6 +35,8 @@
3435
return entries;
3536
});
3637
38+
let colorSpecKey = $derived(buildColorSpecKey(data, colorField, colorMap));
39+
3740
function getBarData() {
3841
const runValues = new Map();
3942
for (const d of data) {
@@ -134,7 +137,7 @@
134137
}
135138
const result = await embed(container, spec, {
136139
actions: false,
137-
renderer: "svg",
140+
renderer: "canvas",
138141
});
139142
view = result.view;
140143
requestAnimationFrame(() => {
@@ -172,7 +175,7 @@
172175
async function downloadImage() {
173176
if (!view) return;
174177
try {
175-
const url = await view.toImageURL("png", 2);
178+
const url = await view.toImageURL("png", 4);
176179
const a = document.createElement("a");
177180
a.href = url;
178181
a.download = `${(y || "chart").replace(/\//g, "_")}.png`;
@@ -261,7 +264,7 @@
261264
$effect(() => {
262265
data;
263266
y;
264-
colorMap;
267+
colorSpecKey;
265268
title;
266269
fullscreen;
267270
container;

0 commit comments

Comments
 (0)