Skip to content

✨ make relative outputs and path work better in streamlit #146

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

enryH
Copy link
Collaborator

@enryH enryH commented Jul 9, 2025

Now this works and can be run from the docs folder using:

cd docs
vuegen -c example_config_files/Basic_example_vuegen_demo_notebook_config.yaml -output_dir ../tests/report_examples/Basic_example_vuegen_demo_notebook_cfg
streamlit run ../tests/report_examples/Basic_example_vuegen_demo_notebook_cfg/streamlit_report/sections/report_manager.py

Solution to be implemented for relative paths:

One or both options:

  • unify root path for relative imports in StreamlitReportView class to init. This will allow to make changes to the logic relatively easy.
  • set relative path w.r.t. to entry point of the script
  • store information of from where the report was executed in order to make the entire folder 'movevable'

enryH added 8 commits July 9, 2025 15:01
…folder

Now this works and can be run from the docs folder using:
cd docs
vuegen -c example_config_files/Basic_example_vuegen_demo_notebook_config.yaml -output_dir ../tests/report_examples/Basic_example_vuegen_demo_notebook_cfg
streamlit run ../tests/report_examples/Basic_example_vuegen_demo_notebook_cfg/streamlit_report/sections/report_manager.py
- this should also bug in `split_readme.py` where the link was not updated, leading to a missing landing page!
- outputdir only really makes sense for report generation,
  not execution: In the current implementation the report has to execute from the path it was generated from
- should the static dir be change upon change of section_dir?
- currently the section_dir is set with the knowleadge of the
  streamlit report structure
- Allows to execute report from everywhere on that operating system
- folder with streamlit report cannot be copied though.
- could also contain completion message?
@enryH enryH marked this pull request as ready for review July 16, 2025 12:14
@enryH enryH requested review from sayalaruano and Copilot July 16, 2025 12:14
Copy link

@Copilot 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 refactors how the generated Streamlit report handles relative paths by introducing a consistent section_dir, updating all section scripts to compute file paths via pathlib, and recording the report’s execution context.

  • Introduce sections_dir parameter and self.section_dir attribute in StreamlitReportView
  • Change all generated Python section files to import Path, set section_dir, and compute plot_file_path/file_path via (section_dir / …).resolve().as_posix()
  • Update CI workflow, docs, Makefile, and config files to point to the new docs/images/logo/ path and validate report generation in tests

Reviewed Changes

Copilot reviewed 27 out of 27 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/vuegen/streamlit_reportview.py Added sections_dir init param; use self.section_dir for relative imports and README
src/vuegen/report_generator.py Pass sections_dir to view; drop explicit output_dir args
tests/report_examples/**/streamlit_report/sections//.py (all section scripts) Import Path, define section_dir, and build file paths via section_dir
tests/report_examples/**/streamlit_report/static/Man_Example.html No change in logic, static HTML moved under correct static dir
gui/Makefile Updated pyinstaller add-data path to docs/images/logo/vuegen_logo.png
.github/workflows/cdci.yml Added a step to regenerate and check Streamlit report
docs/vuegen_basic_case_study_configfile.md Updated logo URL to .../docs/images/logo/...
docs/example_config_files/*.yaml Updated logo and graphical_abstract URLs to new logo/ path
docs/split_readme.py Pointed VueGen logo to new logo/ directory
docs/**/README.md and .ipynb Updated image paths and notebook metadata versions
Comments suppressed due to low confidence (3)

src/vuegen/streamlit_reportview.py:53

  • [nitpick] The parameter name sections_dir is inconsistent with the attribute self.section_dir; consider renaming the parameter to section_dir to match and avoid confusion.
        sections_dir: str = SECTIONS_DIR,

src/vuegen/streamlit_reportview.py:92

  • The docstring still refers to a default of SECTIONS_DIR; update it to explain that output_dir is now optional and defaults to the configured section_dir when None.
    def generate_report(self, output_dir: str = None) -> None:

src/vuegen/report_generator.py:113

  • [nitpick] Since generate_report no longer accepts an explicit output_dir, ensure callers relying on output_dir continue to work; consider logging a warning if the CLI passed an --output_dir flag.
        st_report.generate_report()

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.

1 participant