@@ -17,7 +17,7 @@ class QuartoReportView(r.ReportView):
1717 """
1818
1919 BASE_DIR = "quarto_report"
20- STATIC_FILES_DIR = os . path . join (BASE_DIR , "static" )
20+ STATIC_FILES_DIR = Path (BASE_DIR ) / "static"
2121
2222 def __init__ (self , report : r .Report , report_type : r .ReportType ):
2323 super ().__init__ (report = report , report_type = report_type )
@@ -132,9 +132,7 @@ def generate_report(
132132 report_formatted_imports = "\n " .join (report_unique_imports )
133133
134134 # Write the navigation and general content to a Python file
135- with open (
136- os .path .join (output_dir , f"{ self .BASE_DIR } .qmd" ), "w"
137- ) as quarto_report :
135+ with open (Path (output_dir ) / f"{ self .BASE_DIR } .qmd" , "w" ) as quarto_report :
138136 quarto_report .write (yaml_header )
139137 quarto_report .write (
140138 f"""\n ```{{python}}
@@ -171,7 +169,7 @@ def run_report(self, output_dir: str = BASE_DIR) -> None:
171169 )
172170 if not self .BUNDLED_EXECUTION :
173171 subprocess .run (
174- args ,
172+ [ "quarto" , "render" , os . path . join ( output_dir , f" { self . BASE_DIR } .qmd" )] ,
175173 check = True ,
176174 )
177175 try :
@@ -278,7 +276,7 @@ def _create_yaml_header(self) -> str:
278276 <a href="https://github.com/Multiomics-Analytics-Group/vuegen" target="_blank">
279277 <img src="https://raw.githubusercontent.com/Multiomics-Analytics-Group/vuegen/main/docs/images/vuegen_logo.svg" alt="VueGen" width="65px">
280278 </a>
281- | © 2025 <a href="https://github.com/Multiomics-Analytics-Group" target="_blank">Multiomics Network Analytics Group (MoNA)</a>
279+ | Copyright 2025 <a href="https://github.com/Multiomics-Analytics-Group" target="_blank">Multiomics Network Analytics Group (MoNA)</a>
282280 </footer>""" ,
283281 r .ReportType .PDF : """
284282 pdf:
@@ -324,7 +322,7 @@ def _create_yaml_header(self) -> str:
324322 <a href="https://github.com/Multiomics-Analytics-Group/vuegen" target="_blank">
325323 <img src="https://raw.githubusercontent.com/Multiomics-Analytics-Group/vuegen/main/docs/images/vuegen_logo.svg" alt="VueGen" width="65px">
326324 </a>
327- | © 2025 <a href="https://github.com/Multiomics-Analytics-Group" target="_blank">Multiomics Network Analytics Group (MoNA)</a>
325+ | Copyright 2025 <a href="https://github.com/Multiomics-Analytics-Group" target="_blank">Multiomics Network Analytics Group (MoNA)</a>
328326 </footer>""" ,
329327 r .ReportType .PPTX : """
330328 pptx:
@@ -355,7 +353,7 @@ def _create_yaml_header(self) -> str:
355353 <a href="https://github.com/Multiomics-Analytics-Group/vuegen" target="_blank">
356354 <img src="../docs/images/vuegen_logo.svg" alt="VueGen" width="65px">
357355 </a>
358- | © 2025 <a href="https://github.com/Multiomics-Analytics-Group" target="_blank">Multiomics Network Analytics Group (MoNA)</a>
356+ | Copyright 2025 <a href="https://github.com/Multiomics-Analytics-Group" target="_blank">Multiomics Network Analytics Group (MoNA)</a>
359357 </footer>""" ,
360358 }
361359 # Create a key based on the report type and format
@@ -464,13 +462,9 @@ def _generate_plot_content(
464462
465463 # Define plot path
466464 if is_report_static :
467- static_plot_path = os .path .join (
468- static_dir , f"{ plot .title .replace (' ' , '_' )} .png"
469- )
465+ static_plot_path = Path (static_dir ) / f"{ plot .title .replace (' ' , '_' )} .png"
470466 else :
471- html_plot_file = os .path .join (
472- static_dir , f"{ plot .title .replace (' ' , '_' )} .html"
473- )
467+ html_plot_file = Path (static_dir ) / f"{ plot .title .replace (' ' , '_' )} .html"
474468
475469 # Add content for the different plot types
476470 try :
@@ -482,7 +476,7 @@ def _generate_plot_content(
482476 plot_content .append (self ._generate_plot_code (plot ))
483477 if is_report_static :
484478 plot_content .append (
485- f"""fig_plotly.write_image("{ os . path . abspath ( static_plot_path )} ")\n ```\n """
479+ f"""fig_plotly.write_image("{ static_plot_path . resolve ( )} ")\n ```\n """
486480 )
487481 plot_content .append (self ._generate_image_content (static_plot_path ))
488482 else :
@@ -491,7 +485,7 @@ def _generate_plot_content(
491485 plot_content .append (self ._generate_plot_code (plot ))
492486 if is_report_static :
493487 plot_content .append (
494- f"""fig_altair.save("{ os . path . abspath ( static_plot_path )} ")\n ```\n """
488+ f"""fig_altair.save("{ static_plot_path . resolve ( )} ")\n ```\n """
495489 )
496490 plot_content .append (self ._generate_image_content (static_plot_path ))
497491 else :
@@ -564,7 +558,7 @@ def _generate_plot_code(self, plot, output_file="") -> str:
564558plot_json = response.text\n """
565559 else : # If it's a local file
566560 plot_code += f"""
567- with open('{ os . path . join (".." , plot .file_path ) } ', 'r') as plot_file:
561+ with open('{ Path (".." ) / plot .file_path } ', 'r') as plot_file:
568562 plot_json = plot_file.read()\n """
569563 # Add specific code for each visualization tool
570564 if plot .plot_type == r .PlotType .PLOTLY :
@@ -578,7 +572,7 @@ def _generate_plot_code(self, plot, output_file="") -> str:
578572 if is_url (plot .file_path ) and plot .file_path .endswith (".html" ):
579573 iframe_src = output_file
580574 else :
581- iframe_src = os . path . join (".." , output_file )
575+ iframe_src = Path (".." ) / output_file
582576
583577 # Embed the HTML file in an iframe
584578 plot_code = f"""
@@ -624,7 +618,7 @@ def _generate_dataframe_content(self, dataframe, is_report_static) -> List[str]:
624618 }
625619 try :
626620 # Check if the file extension matches any DataFrameFormat value
627- file_extension = os . path . splitext (dataframe .file_path )[ 1 ] .lower ()
621+ file_extension = Path (dataframe .file_path ). suffix .lower ()
628622 if not any (
629623 file_extension == fmt .value_with_dot for fmt in r .DataFrameFormat
630624 ):
@@ -636,7 +630,7 @@ def _generate_dataframe_content(self, dataframe, is_report_static) -> List[str]:
636630 file_path = (
637631 dataframe .file_path
638632 if is_url (dataframe .file_path )
639- else os . path . join (".." , dataframe .file_path )
633+ else Path (".." ) / dataframe .file_path
640634 )
641635
642636 # Load the DataFrame using the correct function
@@ -699,7 +693,7 @@ def _generate_markdown_content(self, markdown) -> List[str]:
699693 else : # If it's a local file
700694 markdown_content .append (
701695 f"""
702- with open('{ os . path . join (".." , markdown .file_path ) } ', 'r') as markdown_file:
696+ with open('{ Path (".." ) / markdown .file_path } ', 'r') as markdown_file:
703697 markdown_content = markdown_file.read()\n """
704698 )
705699
@@ -745,7 +739,7 @@ def _generate_html_content(self, html) -> List[str]:
745739 iframe_src = (
746740 html .file_path
747741 if is_url (html .file_path )
748- else os . path . join (".." , html .file_path )
742+ else Path (".." ) / html .file_path
749743 )
750744 iframe_code = f"""
751745<div style="text-align: center;">
@@ -820,11 +814,9 @@ def _show_dataframe(
820814 dataframe_content = []
821815 if is_report_static :
822816 # Generate path for the DataFrame image
823- df_image = os .path .join (
824- static_dir , f"{ dataframe .title .replace (' ' , '_' )} .png"
825- )
817+ df_image = Path (static_dir ) / f"{ dataframe .title .replace (' ' , '_' )} .png"
826818 dataframe_content .append (
827- f"df.dfi.export('{ os . path . abspath (df_image )} ', max_rows=10, max_cols=5)\n ```\n "
819+ f"df.dfi.export('{ Path (df_image ). resolve ( )} ', max_rows=10, max_cols=5)\n ```\n "
828820 )
829821 # Use helper method to add centered image content
830822 dataframe_content .append (self ._generate_image_content (df_image ))
0 commit comments