diff --git a/.streamlit/config.toml b/.streamlit/config.toml index 0b90ad2..6c7053a 100644 --- a/.streamlit/config.toml +++ b/.streamlit/config.toml @@ -1,5 +1,4 @@ [theme] -base = "auto" primaryColor = "#F63366" backgroundColor = "#0E1117" secondaryBackgroundColor = "#262730" diff --git a/CHANGELOG.md b/CHANGELOG.md index 9bcfab0..6b17437 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,4 +37,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) ## [1.0.2] – 2025-07-08  :dependabot: **“Dependency Update”** ### Changed - **Streamlit App**: - - Updated `kaleido` dependency to latest version. \ No newline at end of file + - Updated `kaleido` dependency to latest version. + +## [1.0.3] – 2025-07-15  :bug: **“Patch Release”** +### Fixed +- **Streamlit Cloud App**: + - Fixed issue with PNG export not working in the latest version of Kaleido, new major version of Kaleido now requires Chromium to be installed. So we have downgraded Kaleido to 0.2.1. We have tried to call `kaleido.get_chrome_sync()` to ensure it works in Streamlit Cloud and other environments, but it is not + possible to call it in the Streamlit Cloud environment, the Streamlit Cloud environment does not allow changing system environment variables like `KALEIDO_CACHE_DIR` or calling `kaleido.get_chrome_sync()`. So we have removed the call to `kaleido.get_chrome_sync()` and set the default format, width, height, and scale for PNG export using `pio.kaleido.scope`. For this we also had to update the `plotly` dependency to `<6.0.0` to ensure compatibility with the `0.2.1` version of `kaleido`. \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index d13e548..5430c2f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,7 +27,7 @@ RUN apt-get update && apt-get install -y \ # Install Python dependencies RUN pip install --no-cache-dir --upgrade pip \ && pip install --no-cache-dir -e . \ - && pip install --no-cache-dir streamlit plotly matplotlib kaleido + && pip install --no-cache-dir streamlit "plotly<6.0.0" matplotlib "kaleido<1.0.0" # Set the Streamlit port ENV PORT=8501 diff --git a/README.md b/README.md index 0bb4e79..100ccad 100644 --- a/README.md +++ b/README.md @@ -463,7 +463,7 @@ docker build -t merrypopins-app . # Run the app on http://localhost:8501 docker run -p 8501:8501 merrypopins-app ``` -#### 🌐 Option 2: Pull and Run Pre-built Image from Docker Hub +#### 🌐 Option 2: Pull and Run Pre-built Image from Docker Hub (Recommended) ```bash # Pull the latest pre-built image from Docker Hub diff --git a/pyproject.toml b/pyproject.toml index 53b1788..bc9c55d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "merrypopins" -version = "1.0.2" +version = "1.0.3" description = "Merrypopins: Automated pop-in detection for nano-indentation experiments tooling: load_datasets, preprocess, locate, statistics & make_dataset" readme = "README.md" requires-python = ">=3.10,<3.13" diff --git a/src/merrypopins/__init__.py b/src/merrypopins/__init__.py index e3bc9e7..26cf66c 100644 --- a/src/merrypopins/__init__.py +++ b/src/merrypopins/__init__.py @@ -11,7 +11,7 @@ - `make_dataset`: Construct enriched datasets by running the full pipeline and exporting annotated results and visualizations. """ -__version__ = "1.0.2" +__version__ = "1.0.3" # Expose submodules at the package level from . import load_datasets, preprocess, locate, statistics, make_dataset diff --git a/streamlit_app/app.py b/streamlit_app/app.py index 4906662..5d82cd3 100644 --- a/streamlit_app/app.py +++ b/streamlit_app/app.py @@ -21,7 +21,6 @@ import plotly.express as px import plotly.io as pio import streamlit as st -import kaleido from merrypopins.load_datasets import load_txt, load_tdm from merrypopins.preprocess import ( @@ -44,14 +43,6 @@ default_statistics_stress_strain, ) -# Ensure Kaleido uses the latest version and has access to Chrome for rendering -# This is necessary for Plotly to export figures as PNGs correctly. -# Note: Kaleido 1.0.0+ requires a Chromium installation to work properly -# This is a workaround to ensure it works in Streamlit Cloud and other environments. -# If you encounter issues with PNG export, ensure you have Chrome installed or use a compatible version -# of Kaleido that does not require Chrome. -kaleido.get_chrome_sync() - # ─────────────────────────────────────────────────────────────── # 1 ∙ PAGE CONFIG & APP‑LEVEL LOGGING # ─────────────────────────────────────────────────────────────── @@ -76,10 +67,10 @@ # —— upload and png helper ———————————————————————————— # ── ensure PNG export always uses Kaleido ────────────────────── -pio.defaults.default_format = "png" # <-- new -pio.defaults.default_width = 1000 # optional defaults -pio.defaults.default_height = 600 -pio.defaults.default_scale = 2 +pio.kaleido.scope.default_format = "png" # <-- new +pio.kaleido.scope.default_width = 1000 # optional defaults +pio.kaleido.scope.default_height = 600 +pio.kaleido.scope.default_scale = 2 def _fig_to_png(fig) -> bytes: diff --git a/streamlit_app/requirements.txt b/streamlit_app/requirements.txt index 49a29c8..09e0d60 100644 --- a/streamlit_app/requirements.txt +++ b/streamlit_app/requirements.txt @@ -1,5 +1,5 @@ streamlit -plotly +plotly<6.0.0 pandas merrypopins -kaleido \ No newline at end of file +kaleido<1.0.0 \ No newline at end of file