Skip to content

🐛 allow to specify output folder - use only relative paths#136

Merged
enryH merged 7 commits intomainfrom
quarto_qmd_paths
Jun 24, 2025
Merged

🐛 allow to specify output folder - use only relative paths#136
enryH merged 7 commits intomainfrom
quarto_qmd_paths

Conversation

@enryH
Copy link
Copy Markdown
Collaborator

@enryH enryH commented Jun 23, 2025

  • before other locations were not working, see relative imports fail for some output folders #135
  • everything is relative to the generated qmd report now
    • quarto without any additional parameters uses path relative to qmd file
    • in qmd report python snippets can use report_dir (cwd and quarto report file locaction)

Commit qmd file for html output to get an idea of structure and prepare integration tests

enryH added 2 commits June 23, 2025 16:52
- before other locations were not working, see #135
- everything is relative to  the generated qmd report now
   - quarto without any additional parameters uses path relative to qmd file
   - in qmd report python snippets can use `report_dir` (cwd and quarto report file locaction)

Commit qmd file for html output to get an idea of structure and prepare integration tests
@enryH enryH linked an issue Jun 23, 2025 that may be closed by this pull request
@enryH enryH requested review from Copilot and sayalaruano June 23, 2025 15:45
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enables specifying a custom output folder for reports and ensures all file references use relative paths based on that folder. Key changes include:

  • Extending get_relative_file_path to target a custom “relativ_to” directory.
  • Introducing an output_dir attribute in QuartoReportView and updating path resolutions throughout.
  • Adding a sample .qmd report and updating tests to validate HTML output structure.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/report_examples/README.md Updated CLI invocation example to include -output_dir and -rt html
tests/report_examples/.../quarto_report/quarto_report.qmd Committed a full QMD template for HTML report integration tests
src/vuegen/utils/init.py Extended get_relative_file_path signature with new relativ_to arg
src/vuegen/report_generator.py Added a TODO to propagate output_dir into QuartoReportView init
src/vuegen/quarto_reportview.py Tracked self.output_dir and refactored relative-path logic
Comments suppressed due to low confidence (2)

tests/report_examples/README.md:13

  • The stray # on this line splits the example into two lines and breaks the CLI command. Remove it and keep the vuegen invocation on a single line to match the intended usage.
#

src/vuegen/utils/init.py:178

  • [nitpick] The parameter name relativ_to appears to be a typo. Consider renaming it to relative_to for clarity and consistency.
    file_path: str, base_path: str = "", relativ_to: str = "."


## Static Plots
### Number Samples Per Study
![](../../../../docs/example_data/Basic_example_vuegen_demo_notebook/1_Plots/2_Static_plots/1_number_samples_per_study.png){fig-alt= width=90%}
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so moving the report file around will only work with absolute paths. I did not manage to write proper absolute paths here as it was always prefixed with a dot: ./Users/path/to/image.png

Copy link
Copy Markdown
Collaborator

@sayalaruano sayalaruano Jun 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I managed to make the absolute paths to work on all Quarto report types, see #137

#| label: 'Plotly Plot R 6'
#| fig-cap: ""

with open(report_dir /'../../../../docs/example_data/Basic_example_vuegen_demo_notebook/1_Plots/1_Interactive_plots/6_plotly_plot_R.json', 'r') as plot_file:
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this we could fix to be able to move it at least somewhat. otherwise we would need to copy files (which not what we want). the built reports are anyways transportable and we do not intend to have the qmd files further used, I hope.

@sayalaruano
Copy link
Copy Markdown
Collaborator

We will maintain the relative path approach for now, as it simplifies sharing the QMD and report files. We need to specify this behavior in the documentation so that users are aware of this convention.

For future work, we can implement an option to enable relative or absolute paths, so we keep the #137 PR open.


# Define plot path
if self.is_report_static:
# ? should that be in the output folder
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it should be there because then to load the static files, we assume they are there

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then we should remove the static folder argument in the report class so that we always set it w.r.t the output folder

@enryH enryH merged commit 0d173fc into main Jun 24, 2025
14 checks passed
@enryH enryH deleted the quarto_qmd_paths branch June 24, 2025 10:58
enryH added a commit that referenced this pull request Jun 24, 2025
- update tests
- make altair plot path relative to qmd file
enryH added a commit that referenced this pull request Jun 25, 2025
* 🚧 start to explore adding subsections to homesection

* ✨ revert to homepage layout as before, add new section

- use the homepage layout as it was before: title, descrpiton, logo and graphical abstract
- if there are components in the main folder, trigger to add section with main folder name if the configuration is built using the directory based method.
  - a new section with the components is added
  - if configs are created manually, the first section is treated as every other section

* 🐛 fix syntax error (two closing parantheses)

* 🐛 Make excel df paths relative insetad of absolute

* 🚧 add current state of qmd notebooks

- move html report file to correct place: update rel. paths
- add others as of now

* 🐛 ignore description.md and empty sections

- do not use description as component in main folder
- the description is added to the key description

* 🐛 resolve file path first

* 🐛 fix issue with non-directory generated config files, add test

- do not treat first section special
- add example of how to run this config - check in cdci workflow

* 🐛 fix path to tests/report_examples

* 🐛 add correct file ending..

* ✅ test all report types based on quarto (update static path setting)

* 🐛 bash for loop needs to be close using done

* 🐛 get rid of absolute path (missed in #136)

- update tests
- make altair plot path relative to qmd file

* 🎨 clean-up comments/prints and improve logic

* 📝 Update example config files for basic and EMP case studies and update execution section of README

* 💚 Correct paths relative to the docs folder to pass CI tests

* 📝 Update README with details about running vuegen using the cofig exmaple files

* 🐛 commit change to test from svg to png logo

---------

Co-authored-by: sayalaruano <sebasar1245@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

relative imports fail for some output folders

3 participants