Skip to content

Commit 5f24bcc

Browse files
sayalaruanoenryH
andauthored
🐛 Fix dfi library issue to export a dataframe as an image (#74)
* 🐛 Fix: solve issue of the dfi library to export a dataframe as an image for static reports. Also, publish a new streamlit report upon a new release * 🐛 Fix: remove unnecesary indentation * 🥅 Build: add validation for quarto installation. Closes #47 * 🎨 Fix: add indentation following black format * 🐛 Build: remove space to follow black format * 🐛 increase limit of per cell execution timeout for mystnb --------- Co-authored-by: Henry Webel <heweb@dtu.dk>
1 parent 1c7d478 commit 5f24bcc

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

.github/workflows/docs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ jobs:
5757
run: |
5858
find docs/streamlit_report/sections -type f -name "*.py" -exec sed -i 's|/home/runner/work/vuegen/vuegen/docs/||g' {} +
5959
- name: Publish Streamlit report to streamlit-example branch
60+
if: startsWith(github.ref, 'refs/tags')
6061
uses: peaceiris/actions-gh-pages@v4
6162
with:
6263
github_token: ${{ secrets.GITHUB_TOKEN }}

docs/conf.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@
5656
nb_execution_raise_on_error = True
5757
# Rendering
5858
nb_merge_streams = True
59+
# maximum execution time per cell in seconds
60+
nb_execution_timeout = 120
5961

6062
# https://myst-nb.readthedocs.io/en/latest/authoring/custom-formats.html#write-custom-formats
6163
# ! if you use it, then you cannot directly execute the notebook in the browser in colab

src/vuegen/quarto_reportview.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,7 @@ def _show_dataframe(
773773
static_dir, f"{dataframe.title.replace(' ', '_')}.png"
774774
)
775775
dataframe_content.append(
776-
f"dfi.export(df, '{os.path.abspath(df_image)}', max_rows=10, max_cols=5)\n```\n"
776+
f"df.dfi.export('{os.path.abspath(df_image)}', max_rows=10, max_cols=5)\n```\n"
777777
)
778778
# Use helper method to add centered image content
779779
dataframe_content.append(self._generate_image_content(df_image))

src/vuegen/report_generator.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import logging
2+
import shutil
23

34
from .config_manager import ConfigManager
45
from .quarto_reportview import QuartoReportView
@@ -61,6 +62,14 @@ def get_report(
6162
st_report.run_report()
6263

6364
else:
65+
# Check if Quarto is installed
66+
if shutil.which("quarto") is None:
67+
logger.error(
68+
"Quarto is not installed. Please install Quarto before generating this report type."
69+
)
70+
raise RuntimeError(
71+
"Quarto is not installed. Please install Quarto before generating this report type."
72+
)
6473
quarto_report = QuartoReportView(report=report, report_type=report_type)
6574
quarto_report.generate_report()
6675
quarto_report.run_report()

0 commit comments

Comments
 (0)