Skip to content

Commit 1d44eba

Browse files
author
enryh
committed
🐛 save streamlit report files with Posix path for each component, section etc
1 parent 08bea02 commit 1d44eba

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/vuegen/config_manager.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ def _create_component_config_fromfile(self, file_path: Path) -> Dict[str, str]:
6363

6464
# Add title, file path, and description
6565
component_config["title"] = self._create_title_fromdir(file_path.name)
66-
component_config["file_path"] = str(file_path.resolve())
66+
component_config["file_path"] = (
67+
file_path.resolve().as_posix()
68+
) # ! needs to be posix for all OS support
6769
component_config["description"] = ""
6870
component_config["caption"] = ""
6971

src/vuegen/streamlit_reportview.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
import subprocess
3+
from pathlib import Path
34
from typing import List
45

56
import pandas as pd
@@ -106,9 +107,9 @@ def generate_report(
106107

107108
for subsection in section.subsections:
108109
subsection_name_var = subsection.title.replace(" ", "_")
109-
subsection_file_path = os.path.join(
110-
section_name_var, subsection_name_var + ".py"
111-
)
110+
subsection_file_path = (
111+
Path(section_name_var) / f"{subsection_name_var}.py"
112+
).as_posix() # Make sure it's Posix Paths
112113

113114
# Create a Page object for each subsection and add it to the home page content
114115
report_manag_content.append(
@@ -274,7 +275,7 @@ def _generate_home_section(
274275

275276
# Add the home page to the report manager content
276277
report_manag_content.append(
277-
f"homepage = st.Page('Home/Homepage.py', title='Homepage')"
278+
f"homepage = st.Page('Home/Homepage.py', title='Homepage')" # ! here Posix Path is hardcoded
278279
)
279280
report_manag_content.append(f"sections_pages['Home'] = [homepage]\n")
280281
self.report.logger.info("Home page added to the report manager content.")

0 commit comments

Comments
 (0)