Skip to content

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 Copilot and sayalaruano July 16, 2025 12:14
Copy link

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()

Copy link
Collaborator

@sayalaruano sayalaruano left a comment

Choose a reason for hiding this comment

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

It is looking good, thanks a lot for taking care of it :)

I just encountered a small bug. When I ran the streamlit app with the EMP directory, there is an indentation error with the description of the project on the Home page. It looks like this in the generated Python file:

          st.markdown(
              (
                  "<p style='text-align: center; "
                  "color: #000000;'>The Earth Microbiome Project (EMP) is a systematic attempt to characterize global microbial taxonomic and functional diversity for the benefit of the planet and humankind. 
It aimed to sample the Earth’s microbial communities at an unprecedented scale in order to advance our understanding of the organizing biogeographic principles that govern microbial community structure. 
The EMP dataset is generated from samples that individual researchers have compiled and contributed to the EMP. 
The result is both a reference database giving global context to DNA sequence data and a framework for incorporating data from future studies, fostering increasingly complete characterization of Earth’s microbial diversity.

You can find more information about the Earth Microbiome Project at https://earthmicrobiome.org/ and in the [original article](https://www.nature.com/articles/nature24621).</p>"
              ),
              unsafe_allow_html=True)

@sayalaruano
Copy link
Collaborator

Also, I think that it would be nice to implement the code to identify if there is an image in the root folder of the data, and assign it to the graphical_abstract parameter. What do you think? Should we do this on this PR or create a new one?

@enryH
Copy link
Collaborator Author

enryH commented Jul 17, 2025

Yes we can add that, but I would do it in a new PR.

@enryH
Copy link
Collaborator Author

enryH commented Jul 17, 2025

It is looking good, thanks a lot for taking care of it :)

I just encountered a small bug. When I ran the streamlit app with the EMP directory, there is an indentation error with the description of the project on the Home page. It looks like this in the generated Python file:

          st.markdown(
              (
                  "<p style='text-align: center; "
                  "color: #000000;'>The Earth Microbiome Project (EMP) is a systematic attempt to characterize global microbial taxonomic and functional diversity for the benefit of the planet and humankind. 
It aimed to sample the Earth’s microbial communities at an unprecedented scale in order to advance our understanding of the organizing biogeographic principles that govern microbial community structure. 
The EMP dataset is generated from samples that individual researchers have compiled and contributed to the EMP. 
The result is both a reference database giving global context to DNA sequence data and a framework for incorporating data from future studies, fostering increasingly complete characterization of Earth’s microbial diversity.

You can find more information about the Earth Microbiome Project at https://earthmicrobiome.org/ and in the [original article](https://www.nature.com/articles/nature24621).</p>"
              ),
              unsafe_allow_html=True)

This was actually a regression from the rewriting of markdown blocks using textwrap. We should probably add that as a test to our CI

@enryH
Copy link
Collaborator Author

enryH commented Jul 17, 2025

The changes are quite extended, so not too clutter this I will open a new PR only with the required changes for this specific error of multi-line description documents.

@enryH enryH mentioned this pull request Jul 17, 2025
3 tasks
(default is SECTIONS_DIR).
"""
if output_dir is not None:
# ? does this imply changes to the static dir
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Question: Should the static dir always be in the output folder?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, I think so, if there are interactive components when creating static reports, we save these plots in that folder, and read from it.

@enryH enryH merged commit 867d8dc into main Jul 18, 2025
21 of 26 checks passed
@enryH enryH deleted the streamlit_rel_outputs branch July 18, 2025 12:16
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.

3 participants