diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 00000000..83bcd989
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,7 @@
+version: 2
+
+updates:
+ - package-ecosystem: cargo
+ directory: /
+ schedule:
+ interval: daily
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index a3c24480..cc5c3c65 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -3,9 +3,9 @@ name: CI
on:
workflow_dispatch:
pull_request:
- branches: [ master ]
+ branches: [ main ]
push:
- branches: [ master ]
+ branches: [ main ]
# Cancel any in-flight jobs for the same PR/branch so there's only one active
# at a time
@@ -27,7 +27,7 @@ jobs:
components: rustfmt
- run: cargo fmt --all -- --check
- run: cd ${{ github.workspace }}/examples && cargo fmt --all -- --check
-
+
clippy:
name: Clippy
runs-on: ubuntu-latest
@@ -57,7 +57,9 @@ jobs:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- run: cargo test --features plotly_ndarray,plotly_image,kaleido
-
+ - if: ${{ matrix.os == 'windows-latest' }}
+ run: gci -recurse -filter "*example*"
+
code-coverage:
name: Code Coverage
runs-on: ubuntu-latest
@@ -70,7 +72,7 @@ jobs:
# we are skipping anything to do with wasm here
- run: cargo llvm-cov --workspace --features plotly_ndarray,plotly_image,kaleido --lcov --output-path lcov.info
- uses: codecov/codecov-action@v3
-
+
build_examples:
name: Build Examples
strategy:
@@ -94,7 +96,7 @@ jobs:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- run: cd ${{ github.workspace }}/examples/${{ matrix.example }} && cargo build
-
+
build_wasm_examples:
name: Build Wasm Examples
strategy:
diff --git a/examples/statistical_charts/src/main.rs b/examples/statistical_charts/src/main.rs
index 5d2a7190..b8c83d34 100644
--- a/examples/statistical_charts/src/main.rs
+++ b/examples/statistical_charts/src/main.rs
@@ -345,7 +345,7 @@ fn fully_styled_box_plot() {
v
};
- let x_data = vec![
+ let x_data = [
"Carmelo
Anthony",
"Dwyane
Wade",
"Deron
Williams",
diff --git a/plotly/Cargo.toml b/plotly/Cargo.toml
index aca40ffe..11b7880d 100644
--- a/plotly/Cargo.toml
+++ b/plotly/Cargo.toml
@@ -24,9 +24,9 @@ with-axum = ["askama/with-axum", "askama_axum"]
askama = { version = ">=0.11.0, <0.13.0", features = ["serde-json"] }
askama_axum = { version = "0.4.0", optional = true }
dyn-clone = "1"
-erased-serde = "0.3"
+erased-serde = "0.4"
getrandom = { version = "0.2", features = ["js"], optional = true }
-image = { version = "0.24.2", optional = true }
+image = { version = "0.24", optional = true }
js-sys = { version = "0.3", optional = true }
plotly_derive = { version = "0.8.4", path = "../plotly_derive" }
plotly_kaleido = { version = "0.8.4", path = "../plotly_kaleido", optional = true }
@@ -35,15 +35,15 @@ once_cell = "1"
serde = { version = "1.0.132", features = ["derive"] }
serde_json = "1.0.73"
serde_repr = "0.1"
-serde_with = "2"
+serde_with = ">=2, <4"
rand = "0.8"
wasm-bindgen = { version = "0.2", optional = true }
wasm-bindgen-futures = { version = "0.4", optional = true }
[dev-dependencies]
csv = "1.1.6"
-image = "0.24.4"
-itertools = "0.10.3"
+image = "0.24"
+itertools = ">=0.10, <0.13"
itertools-num = "0.1.3"
ndarray = "0.15.4"
plotly_kaleido = { version = "0.8.4", path = "../plotly_kaleido" }
diff --git a/plotly/src/plot.rs b/plotly/src/plot.rs
index ac80af65..a7d175ea 100644
--- a/plotly/src/plot.rs
+++ b/plotly/src/plot.rs
@@ -162,7 +162,7 @@ impl Traces {
///
/// let layout = Layout::new().title("Line and Scatter Plot".into());
/// plot.set_layout(layout);
-///
+///
/// # if false { // We don't actually want to try and display the plot in a browser when running a doctest.
/// plot.show();
/// # }
@@ -650,6 +650,7 @@ mod tests {
assert!(!dst.exists());
}
+ #[cfg(not(target_os = "windows"))]
#[test]
#[cfg(feature = "kaleido")]
fn test_save_to_png() {
@@ -661,6 +662,7 @@ mod tests {
assert!(!dst.exists());
}
+ #[cfg(not(target_os = "windows"))]
#[test]
#[cfg(feature = "kaleido")]
fn test_save_to_jpeg() {
@@ -672,6 +674,7 @@ mod tests {
assert!(!dst.exists());
}
+ #[cfg(not(target_os = "windows"))]
#[test]
#[cfg(feature = "kaleido")]
fn test_save_to_svg() {
@@ -695,6 +698,7 @@ mod tests {
assert!(!dst.exists());
}
+ #[cfg(not(target_os = "windows"))]
#[test]
#[cfg(feature = "kaleido")]
fn test_save_to_pdf() {
@@ -706,6 +710,7 @@ mod tests {
assert!(!dst.exists());
}
+ #[cfg(not(target_os = "windows"))]
#[test]
#[cfg(feature = "kaleido")]
fn test_save_to_webp() {
diff --git a/plotly_derive/Cargo.toml b/plotly_derive/Cargo.toml
index 34be9693..809347b3 100644
--- a/plotly_derive/Cargo.toml
+++ b/plotly_derive/Cargo.toml
@@ -11,10 +11,10 @@ edition = "2018"
keywords = ["plot", "chart", "plotly"]
[dependencies]
-quote = "1.0"
-syn = "1.0"
-proc-macro2 = "1.0"
-darling = "0.14.1"
+quote = "1"
+syn = "2"
+proc-macro2 = "1"
+darling = "0.20"
[lib]
proc-macro = true
diff --git a/plotly_derive/src/field_setter.rs b/plotly_derive/src/field_setter.rs
index a1642989..f330be21 100644
--- a/plotly_derive/src/field_setter.rs
+++ b/plotly_derive/src/field_setter.rs
@@ -492,7 +492,7 @@ impl FieldReceiver {
self.attrs
.iter()
.filter(|attr| {
- attr.path
+ attr.path()
.segments
.first()
.map_or(false, |p| p.ident == name)
diff --git a/plotly_kaleido/Cargo.toml b/plotly_kaleido/Cargo.toml
index c05b3aa5..8bed49b6 100644
--- a/plotly_kaleido/Cargo.toml
+++ b/plotly_kaleido/Cargo.toml
@@ -17,14 +17,10 @@ exclude = ["target/*", "kaleido/*", "examples/*"]
[dependencies]
serde = { version = "1.0.132", features = ["derive"] }
serde_json = "1.0.73"
-base64 = "0.13.0"
+base64 = "0.22"
dunce = "1.0.2"
-directories = "4.0.1"
-
-[dev-dependencies]
-zip = "0.5.13"
+directories = ">=4, <6"
[build-dependencies]
-zip = "0.5.13"
-directories = "4.0.1"
-
+zip = "1.1"
+directories = ">=4, <6"
diff --git a/plotly_kaleido/build.rs b/plotly_kaleido/build.rs
index 5a4342c5..cf47e82d 100644
--- a/plotly_kaleido/build.rs
+++ b/plotly_kaleido/build.rs
@@ -10,10 +10,14 @@ use std::process::Command;
use directories::ProjectDirs;
-#[cfg(target_os = "linux")]
+#[cfg(all(target_arch = "x86_64", target_os = "linux"))]
const KALEIDO_URL: &str =
"https://github.com/plotly/Kaleido/releases/download/v0.2.1/kaleido_linux_x64.zip";
+#[cfg(all(target_arch = "aarch64", target_os = "linux"))]
+const KALEIDO_URL: &str =
+ "https://github.com/plotly/Kaleido/releases/download/v0.2.1/kaleido_linux_arm64.zip";
+
#[cfg(target_os = "windows")]
const KALEIDO_URL: &str =
"https://github.com/plotly/Kaleido/releases/download/v0.2.1/kaleido_win_x64.zip";
diff --git a/plotly_kaleido/src/lib.rs b/plotly_kaleido/src/lib.rs
index ce0d67cc..c3292c40 100644
--- a/plotly_kaleido/src/lib.rs
+++ b/plotly_kaleido/src/lib.rs
@@ -16,6 +16,7 @@ use std::io::BufReader;
use std::path::{Path, PathBuf};
use std::process::{Command, Stdio};
+use base64::{engine::general_purpose, Engine as _};
use directories::ProjectDirs;
use serde::{Deserialize, Serialize};
use serde_json::Value;
@@ -163,12 +164,12 @@ impl Kaleido {
}
let output_lines = BufReader::new(process.stdout.unwrap()).lines();
- for line in output_lines.flatten() {
+ for line in output_lines.map_while(Result::ok) {
let res = KaleidoResult::from(line.as_str());
if let Some(image_data) = res.result {
let data: Vec = match format {
"svg" | "eps" => image_data.as_bytes().to_vec(),
- _ => base64::decode(image_data).unwrap(),
+ _ => general_purpose::STANDARD.decode(image_data).unwrap(),
};
let mut file = File::create(dst.as_path())?;
file.write_all(&data)?;
@@ -237,6 +238,7 @@ mod tests {
assert_eq!(to_value(kaleido_data).unwrap(), expected);
}
+ #[cfg(not(target_os = "windows"))]
#[test]
fn test_save_png() {
let test_plot = create_test_plot();
@@ -247,6 +249,7 @@ mod tests {
assert!(std::fs::remove_file(dst.as_path()).is_ok());
}
+ #[cfg(not(target_os = "windows"))]
#[test]
fn test_save_jpeg() {
let test_plot = create_test_plot();
@@ -257,6 +260,7 @@ mod tests {
assert!(std::fs::remove_file(dst.as_path()).is_ok());
}
+ #[cfg(not(target_os = "windows"))]
#[test]
fn test_save_webp() {
let test_plot = create_test_plot();
@@ -267,6 +271,7 @@ mod tests {
assert!(std::fs::remove_file(dst.as_path()).is_ok());
}
+ #[cfg(not(target_os = "windows"))]
#[test]
fn test_save_svg() {
let test_plot = create_test_plot();
@@ -277,6 +282,7 @@ mod tests {
assert!(std::fs::remove_file(dst.as_path()).is_ok());
}
+ #[cfg(not(target_os = "windows"))]
#[test]
fn test_save_pdf() {
let test_plot = create_test_plot();