Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/cdci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,13 @@ jobs:
python-version: ${{ matrix.python-version }}
cache: "pip" # caching pip dependencies
cache-dependency-path: "**/pyproject.toml"
- name: Install dependencies
- name: lint package code with ruff
run: |
python -m pip install --upgrade pip
pip install ruff
ruff check src
- name: Install dependencies for testing
run: |
pip install pytest
pip install -e .
- name: Run tests
Expand Down
10 changes: 5 additions & 5 deletions src/vuegen/quarto_reportview.py
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ def _generate_plot_content(self, plot) -> List[str]:
)
plot_content.append(self._generate_image_content(static_plot_path))
else:
plot_content.append(f"""fig_plotly.show()\n```\n""")
plot_content.append("""fig_plotly.show()\n```\n""")
elif plot.plot_type == r.PlotType.ALTAIR:
plot_content.append(self._generate_plot_code(plot))
if self.is_report_static:
Expand All @@ -587,15 +587,15 @@ def _generate_plot_content(self, plot) -> List[str]:
)
plot_content.append(self._generate_image_content(static_plot_path))
else:
plot_content.append(f"""fig_altair\n```\n""")
plot_content.append("""fig_altair\n```\n""")
elif plot.plot_type == r.PlotType.INTERACTIVE_NETWORK:
networkx_graph = plot.read_network()
if isinstance(networkx_graph, tuple):
# If network_data is a tuple, separate the network and html file path
networkx_graph, html_plot_file = networkx_graph
elif isinstance(networkx_graph, nx.Graph) and not self.is_report_static:
# Get the pyvis object and create html
pyvis_graph = plot.create_and_save_pyvis_network(
_ = plot.create_and_save_pyvis_network(
networkx_graph, html_plot_file
)

Expand Down Expand Up @@ -805,7 +805,7 @@ def _generate_markdown_content(self, markdown) -> List[str]:
)

# Code to display md content
markdown_content.append(f"""display.Markdown(markdown_content)\n```\n""")
markdown_content.append("""display.Markdown(markdown_content)\n```\n""")

except Exception as e:
self.report.logger.error(
Expand Down Expand Up @@ -926,7 +926,7 @@ def _show_dataframe(self, dataframe) -> List[str]:
else:
# Append code to display the DataFrame interactively
dataframe_content.append(
f"""show(df, classes="display nowrap compact", lengthMenu=[3, 5, 10])\n```\n"""
"""show(df, classes="display nowrap compact", lengthMenu=[3, 5, 10])\n```\n"""
)

return dataframe_content
Expand Down
1 change: 0 additions & 1 deletion src/vuegen/report.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import json
import logging
import os
from abc import ABC, abstractmethod
Expand Down
13 changes: 6 additions & 7 deletions src/vuegen/streamlit_reportview.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def run_report(self, output_dir: str = SECTIONS_DIR) -> None:
f"All the scripts to build the Streamlit app are available at {output_dir}"
)
self.report.logger.info(
f"To run the Streamlit app, use the following command:"
"To run the Streamlit app, use the following command:"
)
self.report.logger.info(
f"streamlit run {Path(output_dir) / self.REPORT_MANAG_SCRIPT}"
Expand Down Expand Up @@ -381,7 +381,7 @@ def _generate_home_section(

# Create the home page content
home_content = []
home_content.append(f"import streamlit as st")
home_content.append("import streamlit as st")
if subsection_imports:
home_content.extend(subsection_imports)
if self.report.description:
Expand Down Expand Up @@ -409,9 +409,9 @@ def _generate_home_section(

# Add the home page to the report manager content
report_manag_content.append(
f"homepage = st.Page('Home/Homepage.py', title='Homepage')" # ! here Posix Path is hardcoded
"homepage = st.Page('Home/Homepage.py', title='Homepage')" # ! here Posix Path is hardcoded
)
report_manag_content.append(f"sections_pages['Home'] = [homepage]\n")
report_manag_content.append("sections_pages['Home'] = [homepage]\n")
self.report.logger.info("Home page added to the report manager content.")
except Exception as e:
self.report.logger.error(f"Error generating the home section: {str(e)}")
Expand All @@ -430,7 +430,6 @@ def _generate_sections(self, output_dir: str) -> None:

try:
for section in self.report.sections[1:]:
section_name_var = section.title.replace(" ", "_")
self.report.logger.debug(
f"Processing section '{section.id}': '{section.title}' - {len(section.subsections)} subsection(s)"
)
Expand Down Expand Up @@ -604,11 +603,11 @@ def _generate_plot_content(self, plot) -> List[str]:
html_plot_file = (
Path(self.static_dir) / f"{plot.title.replace(' ', '_')}.html"
)
pyvis_graph = plot.create_and_save_pyvis_network(
_ = plot.create_and_save_pyvis_network(
networkx_graph, html_plot_file
)

# Add number of nodes and edges to the plor conetnt
# Add number of nodes and edges to the plot content
num_nodes = networkx_graph.number_of_nodes()
num_edges = networkx_graph.number_of_edges()

Expand Down