Skip to content

Commit cf7cac5

Browse files
authored
Merge pull request #61 from jonmmease/release_0.0.2
Release 0.0.2
2 parents 480c402 + 0c63bf1 commit cf7cac5

File tree

14 files changed

+114
-30
lines changed

14 files changed

+114
-30
lines changed

Cargo.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

LICENSE

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Copyright 2024 Jon Mease
2+
3+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4+
5+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6+
7+
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.
8+
9+
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.
10+
11+
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.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ chart = alt.Chart(source).mark_circle(size=60).encode(
3131
)
3232
chart
3333
```
34-
![cars_scatter.png](doc%2Fimages%2Fcars_scatter.png)
34+
![cars_scatter](https://github.com/jonmmease/avenger/assets/15064365/d661e142-c7c5-4816-a375-49a73985bb6d)
3535

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

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

4747
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:
4848

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

5151
# Try it out from Rust
5252
Avenger is written in Rust, and may be used directly from Rust.

avenger-python/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "avenger-python"
3-
version = "0.0.2-a0"
3+
version = "0.0.2"
44
edition = "2021"
55
license = "BSD-3-Clause"
66
description = "Python API to Avenger visualization framework"
@@ -17,17 +17,17 @@ pollster = "0.3"
1717
[dependencies.avenger]
1818
path = "../avenger"
1919
features = [ "pyo3",]
20-
version = "0.0.2-a0"
20+
version = "0.0.2"
2121

2222
[dependencies.avenger-vega]
2323
path = "../avenger-vega"
2424
features = [ "pyo3",]
25-
version = "0.0.2-a0"
25+
version = "0.0.2"
2626

2727
[dependencies.avenger-wgpu]
2828
path = "../avenger-wgpu"
2929
features = [ "pyo3",]
30-
version = "0.0.2-a0"
30+
version = "0.0.2"
3131

3232
[dependencies.pyo3]
3333
workspace = true

avenger-python/LICENSE

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Copyright 2024 Jon Mease
2+
3+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4+
5+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6+
7+
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.
8+
9+
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.
10+
11+
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.

avenger-python/README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Avenger: A visualization engine and renderer
2+
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.
3+
4+
# Try it out in Python with Vega-Altair
5+
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.
6+
7+
First, install altair, vega-datasets, avenger, and vl-convert-python
8+
```
9+
pip install -U altair vega_datasets avenger "vl-convert-python>=1.2.3"
10+
```
11+
12+
Then import Altair and activate the `avenger-png` renderer
13+
14+
```python
15+
import altair as alt
16+
alt.renderers.enable('avenger-png', scale=1)
17+
```
18+
19+
Then create and display an Altair chart as usual:
20+
21+
```python
22+
import altair as alt
23+
from vega_datasets import data
24+
25+
source = data.cars()
26+
27+
chart = alt.Chart(source).mark_circle(size=60).encode(
28+
x='Horsepower',
29+
y='Miles_per_Gallon',
30+
color='Origin',
31+
)
32+
chart
33+
```
34+
![cars_scatter](https://github.com/jonmmease/avenger/assets/15064365/d661e142-c7c5-4816-a375-49a73985bb6d)
35+
36+
Or, convert the chart to a PNG rendered by Avenger:
37+
38+
```python
39+
import avenger
40+
png = avenger.altair_utils.chart_to_png(chart, scale=1)
41+
with open("scatter.png", "wb") as f:
42+
f.write(png)
43+
```
44+
## Comparison to vl-convert
45+
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.
46+
47+
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:
48+
49+
![isotype_emoji](https://github.com/jonmmease/avenger/assets/15064365/91a1db89-9bdd-46f3-b540-c7d7bcaac3c2)

avenger-python/pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
[project]
22
name = "avenger"
3-
version = "0.0.2-a0"
3+
version = "0.0.2"
4+
readme = "README.md"
5+
description = "A Visualization Engine and Renderer"
6+
license = {file = "LICENSE"}
47

58
[build-system]
69
requires = [ "maturin>=1.1.0,<2",]

avenger-vega-test-data/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "avenger-vega-test-data"
3-
version = "0.0.2-a0"
3+
version = "0.0.2"
44
edition = "2021"
55

66
[dependencies]

avenger-vega/Cargo.toml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,36 @@
11
[package]
22
name = "avenger-vega"
3-
version = "0.0.2-a0"
3+
version = "0.0.2"
44
edition = "2021"
55
description = "Utilities for importing Vega scenegraphs into Avenger"
66
license = "BSD-3-Clause"
77

88
[features]
99
image-request = [ "reqwest",]
10-
svg = ["resvg", "usvg", "tiny-skia"]
10+
svg = [ "resvg", "usvg", "tiny-skia",]
1111

1212
[dependencies]
1313
cfg-if = "1"
1414
csscolorparser = "0.6.2"
15-
resvg = { version="0.38.0", optional = true }
16-
usvg = { version="0.38.0", optional = true}
17-
tiny-skia = { version="0.11.3", optional = true}
15+
16+
[dependencies.resvg]
17+
version = "0.38.0"
18+
optional = true
19+
20+
[dependencies.usvg]
21+
version = "0.38.0"
22+
optional = true
23+
24+
[dependencies.tiny-skia]
25+
version = "0.11.3"
26+
optional = true
1827

1928
[dependencies.lazy_static]
2029
workspace = true
2130

2231
[dependencies.avenger]
2332
path = "../avenger"
24-
version = "0.0.2-a0"
33+
version = "0.0.2"
2534

2635
[dependencies.thiserror]
2736
workspace = true

avenger-wgpu/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "avenger-wgpu"
3-
version = "0.0.2-a0"
3+
version = "0.0.2"
44
edition = "2021"
55
description = "WGPU rendering engine for the Avenger visualization framework"
66
license = "BSD-3-Clause"
@@ -32,7 +32,7 @@ rstest = "0.18.2"
3232

3333
[dependencies.avenger]
3434
path = "../avenger"
35-
version = "0.0.2-a0"
35+
version = "0.0.2"
3636

3737
[dependencies.thiserror]
3838
workspace = true
@@ -57,8 +57,8 @@ workspace = true
5757

5858
[dev-dependencies.avenger-vega]
5959
path = "../avenger-vega"
60-
features = [ "image-request", "svg"]
61-
version = "0.0.2-a0"
60+
features = [ "image-request", "svg",]
61+
version = "0.0.2"
6262

6363
[dev-dependencies.serde_json]
6464
version = "1.0.111"

0 commit comments

Comments
 (0)