Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,12 @@ jobs:
run: pixi run dev-py
- name: Run tests
run: pixi run test-py
- name: Upload failed images
uses: actions/upload-artifact@v6
if: failure()
with:
name: failed-images-python-${{ matrix.options[0] }}
path: vl-convert-python/tests/failed/

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

working out intermittent image test failures was a side quest that lead to using the backon retry logic


# Build and test aarch64 Linux wheel using manylinux container
vl-convert-python-tests-linux-aarch64:
Expand Down
11 changes: 11 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ codegen-units = 1
[workspace.dependencies]
anyhow = "1.0"
assert_cmd = "2.0"
backon = { version = "1", default-features = false, features = ["tokio-sleep", "std"] }
clap = { version = "4.5", features = ["derive"] }

# Deno dependencies - versions correspond to Deno v2.6.6
Expand Down
208 changes: 208 additions & 0 deletions thirdparty_rust.yaml

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions vl-convert-python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,22 @@ vg_spec = vlc.vegalite_to_vega(chart.to_json(), vl_version="4.17")
with open("altair_chart.vg.json", "wt") as f:
json.dump(vg_spec, f)
```

## Configure Worker Parallelism
By default, `vl-convert-python` uses `1` converter worker. You can configure this globally:

```python
import vl_convert as vlc

vlc.get_num_workers() # 1
vlc.set_num_workers(4) # enable parallel worker pool
vlc.warm_up_workers() # optional: pre-initialize workers before first conversion
```

This setting applies to subsequent conversions and enables parallel work across Python threads.
Calling `warm_up_workers()` is optional and only needed if you want to avoid first-request
worker startup latency.

# How it works
This crate uses [PyO3](https://pyo3.rs/) to wrap the [`vl-convert-rs`](https://crates.io/crates/vl-convert-rs) Rust crate as a Python library. The `vl-convert-rs` crate is a self-contained Rust library for converting [Vega-Lite](https://vega.github.io/vega-lite/) visualization specifications into various formats. The conversions are performed using the Vega-Lite and Vega JavaScript libraries running in a v8 JavaScript runtime provided by the [`deno_runtime`](https://crates.io/crates/deno_runtime) crate. Font metrics and SVG-to-PNG conversions are provided by the [`resvg`](https://crates.io/crates/resvg) crate.

Expand Down
Loading
Loading