🐛 allow to specify output folder - use only relative paths#136
Conversation
- 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
relevant for static quarto based reports
- also correcting one typo in comment
There was a problem hiding this comment.
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_pathto target a custom “relativ_to” directory. - Introducing an
output_dirattribute inQuartoReportViewand updating path resolutions throughout. - Adding a sample
.qmdreport 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 thevuegeninvocation on a single line to match the intended usage.
#
src/vuegen/utils/init.py:178
- [nitpick] The parameter name
relativ_toappears to be a typo. Consider renaming it torelative_tofor clarity and consistency.
file_path: str, base_path: str = "", relativ_to: str = "."
|
|
||
| ## Static Plots | ||
| ### Number Samples Per Study | ||
| {fig-alt= width=90%} |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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.
|
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 |
There was a problem hiding this comment.
yes, it should be there because then to load the static files, we assume they are there
There was a problem hiding this comment.
then we should remove the static folder argument in the report class so that we always set it w.r.t the output folder
- update tests - make altair plot path relative to qmd file
* 🚧 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>
report_dir(cwd and quarto report file locaction)Commit qmd file for html output to get an idea of structure and prepare integration tests