Skip to content

Commit

Permalink
Merge pull request #61 from jonmmease/release_0.0.2
Browse files Browse the repository at this point in the history
Release 0.0.2
  • Loading branch information
jonmmease authored Feb 2, 2024
2 parents 480c402 + 0c63bf1 commit cf7cac5
Show file tree
Hide file tree
Showing 14 changed files with 114 additions and 30 deletions.
10 changes: 5 additions & 5 deletions Cargo.lock

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

11 changes: 11 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Copyright 2024 Jon Mease

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ chart = alt.Chart(source).mark_circle(size=60).encode(
)
chart
```
![cars_scatter.png](doc%2Fimages%2Fcars_scatter.png)
![cars_scatter](https://github.com/jonmmease/avenger/assets/15064365/d661e142-c7c5-4816-a375-49a73985bb6d)

Or, convert the chart to a PNG rendered by Avenger:

Expand All @@ -46,7 +46,7 @@ There aren't currently many advantages to using Avenger to render Altar charts t

One advantage is that Avenger's text rendering support is based on [COSMIC Text](https://github.com/pop-os/cosmic-text), which supports emoji (unlike resvg's text handling). For example, here is the result of rendering the emoji example from https://altair-viz.github.io/gallery/isotype_emoji.html using Avenger:

![isotype_emoji.png](doc%2Fimages%2Fisotype_emoji.png)
![isotype_emoji](https://github.com/jonmmease/avenger/assets/15064365/91a1db89-9bdd-46f3-b540-c7d7bcaac3c2)

# Try it out from Rust
Avenger is written in Rust, and may be used directly from Rust.
Expand Down
8 changes: 4 additions & 4 deletions avenger-python/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "avenger-python"
version = "0.0.2-a0"
version = "0.0.2"
edition = "2021"
license = "BSD-3-Clause"
description = "Python API to Avenger visualization framework"
Expand All @@ -17,17 +17,17 @@ pollster = "0.3"
[dependencies.avenger]
path = "../avenger"
features = [ "pyo3",]
version = "0.0.2-a0"
version = "0.0.2"

[dependencies.avenger-vega]
path = "../avenger-vega"
features = [ "pyo3",]
version = "0.0.2-a0"
version = "0.0.2"

[dependencies.avenger-wgpu]
path = "../avenger-wgpu"
features = [ "pyo3",]
version = "0.0.2-a0"
version = "0.0.2"

[dependencies.pyo3]
workspace = true
Expand Down
11 changes: 11 additions & 0 deletions avenger-python/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Copyright 2024 Jon Mease

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
49 changes: 49 additions & 0 deletions avenger-python/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Avenger: A visualization engine and renderer
Avenger is an early stage prototype of a new foundational rendering library for information visualization (InfoVis) systems. Avenger defines a 2D scenegraph representation tailored to the needs of InfoVis systems. To start with, the initial application of Avenger is to serve as an alternative, GPU accelerated, rendering backend for Vega visualizations.

# Try it out in Python with Vega-Altair
The `avenger` Python package provides a [custom Altair renderer](https://altair-viz.github.io/user_guide/custom_renderers.html) named `avenger-png`. This renderer relies on vl-convert to extract the vega scenegraph corresponding to a chart and then uses Avenger to render the chart to a static PNG image.

First, install altair, vega-datasets, avenger, and vl-convert-python
```
pip install -U altair vega_datasets avenger "vl-convert-python>=1.2.3"
```

Then import Altair and activate the `avenger-png` renderer

```python
import altair as alt
alt.renderers.enable('avenger-png', scale=1)
```

Then create and display an Altair chart as usual:

```python
import altair as alt
from vega_datasets import data

source = data.cars()

chart = alt.Chart(source).mark_circle(size=60).encode(
x='Horsepower',
y='Miles_per_Gallon',
color='Origin',
)
chart
```
![cars_scatter](https://github.com/jonmmease/avenger/assets/15064365/d661e142-c7c5-4816-a375-49a73985bb6d)

Or, convert the chart to a PNG rendered by Avenger:

```python
import avenger
png = avenger.altair_utils.chart_to_png(chart, scale=1)
with open("scatter.png", "wb") as f:
f.write(png)
```
## Comparison to vl-convert
There aren't currently many advantages to using Avenger to render Altar charts to PNG as compared with vl-convert, which performs rendering using [resvg](https://github.com/RazrFalcon/resvg). Performance is generally comparable, though Avenger can be a bit faster for charts with a large number of symbol instances.

One advantage is that Avenger's text rendering support is based on [COSMIC Text](https://github.com/pop-os/cosmic-text), which supports emoji (unlike resvg's text handling). For example, here is the result of rendering the emoji example from https://altair-viz.github.io/gallery/isotype_emoji.html using Avenger:

![isotype_emoji](https://github.com/jonmmease/avenger/assets/15064365/91a1db89-9bdd-46f3-b540-c7d7bcaac3c2)
5 changes: 4 additions & 1 deletion avenger-python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
[project]
name = "avenger"
version = "0.0.2-a0"
version = "0.0.2"
readme = "README.md"
description = "A Visualization Engine and Renderer"
license = {file = "LICENSE"}

[build-system]
requires = [ "maturin>=1.1.0,<2",]
Expand Down
2 changes: 1 addition & 1 deletion avenger-vega-test-data/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "avenger-vega-test-data"
version = "0.0.2-a0"
version = "0.0.2"
edition = "2021"

[dependencies]
Expand Down
21 changes: 15 additions & 6 deletions avenger-vega/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,27 +1,36 @@
[package]
name = "avenger-vega"
version = "0.0.2-a0"
version = "0.0.2"
edition = "2021"
description = "Utilities for importing Vega scenegraphs into Avenger"
license = "BSD-3-Clause"

[features]
image-request = [ "reqwest",]
svg = ["resvg", "usvg", "tiny-skia"]
svg = [ "resvg", "usvg", "tiny-skia",]

[dependencies]
cfg-if = "1"
csscolorparser = "0.6.2"
resvg = { version="0.38.0", optional = true }
usvg = { version="0.38.0", optional = true}
tiny-skia = { version="0.11.3", optional = true}

[dependencies.resvg]
version = "0.38.0"
optional = true

[dependencies.usvg]
version = "0.38.0"
optional = true

[dependencies.tiny-skia]
version = "0.11.3"
optional = true

[dependencies.lazy_static]
workspace = true

[dependencies.avenger]
path = "../avenger"
version = "0.0.2-a0"
version = "0.0.2"

[dependencies.thiserror]
workspace = true
Expand Down
8 changes: 4 additions & 4 deletions avenger-wgpu/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "avenger-wgpu"
version = "0.0.2-a0"
version = "0.0.2"
edition = "2021"
description = "WGPU rendering engine for the Avenger visualization framework"
license = "BSD-3-Clause"
Expand Down Expand Up @@ -32,7 +32,7 @@ rstest = "0.18.2"

[dependencies.avenger]
path = "../avenger"
version = "0.0.2-a0"
version = "0.0.2"

[dependencies.thiserror]
workspace = true
Expand All @@ -57,8 +57,8 @@ workspace = true

[dev-dependencies.avenger-vega]
path = "../avenger-vega"
features = [ "image-request", "svg"]
version = "0.0.2-a0"
features = [ "image-request", "svg",]
version = "0.0.2"

[dev-dependencies.serde_json]
version = "1.0.111"
2 changes: 1 addition & 1 deletion avenger/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "avenger"
version = "0.0.2-a0"
version = "0.0.2"
edition = "2021"
description = "A visualization engine and renderer"
license = "BSD-3-Clause"
Expand Down
6 changes: 3 additions & 3 deletions examples/scatter-panning/Cargo.lock

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

6 changes: 3 additions & 3 deletions examples/wgpu-winit/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 pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ platforms = ["osx-arm64"]

[tasks]
dev-py = { cmd = ["maturin", "develop", "-m", "avenger-python/Cargo.toml", "--release"]}
build-py = { cmd = ["maturin", "build", "-m", "avenger-python/Cargo.toml", "--sdist", "--release"]}
bump-version = { cmd = ["python", "automation/bump_version.py"] }

[tasks.publish-rs]
Expand Down

0 comments on commit cf7cac5

Please sign in to comment.