Skip to content

Commit b0dce90

Browse files
committed
🐛 sort imports so it's not depend on random (set), statements after imports
1 parent e0e3754 commit b0dce90

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

src/vuegen/streamlit_reportview.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,6 @@ def _generate_home_section(
374374
all_components, subsection_imports, _ = self._combine_components(
375375
home_section.components
376376
)
377-
378377
try:
379378
# Create folder for the home page
380379
home_dir_path = Path(output_dir) / "Home"
@@ -388,7 +387,6 @@ def _generate_home_section(
388387
# Create the home page content
389388
home_content = []
390389
subsection_imports.append("import streamlit as st")
391-
392390
subsection_imports = set(subsection_imports)
393391
subsection_imports, _ = sort_imports(subsection_imports)
394392

@@ -526,6 +524,8 @@ def _combine_components(self, components: list[dict]) -> tuple[list, list, bool]
526524
all_contents.extend(content)
527525
# remove duplicates
528526
all_imports = list(set(all_imports))
527+
all_imports, setup_statements = sort_imports(all_imports)
528+
all_imports.extend(setup_statements)
529529
return all_contents, all_imports, has_chatbot
530530

531531
def _generate_subsection(self, subsection) -> tuple[List[str], List[str]]:

tests/report_examples/Basic_example_vuegen_demo_notebook/streamlit_report/sections/Dataframes/All_Formats.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
from st_aggrid import AgGrid, GridOptionsBuilder
2+
from vuegen import table_utils
13
import pandas as pd
24
import streamlit as st
35
df_index = 1
4-
from vuegen import table_utils
5-
from st_aggrid import AgGrid, GridOptionsBuilder
66

77
st.markdown('''<h3 style='text-align: center; color: #023558;'>All Formats</h3>''', unsafe_allow_html=True)
88
st.markdown('''<h4 style='text-align: center; color: #2b8cbe;'>Phyla Correlation Network Csv</h4>''', unsafe_allow_html=True)

tests/report_examples/Basic_example_vuegen_demo_notebook/streamlit_report/sections/Html/All_Html.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import streamlit as st
21
import requests
2+
import streamlit as st
33

44
st.markdown('''<h3 style='text-align: center; color: #023558;'>All Html</h3>''', unsafe_allow_html=True)
55
st.markdown('''<h4 style='text-align: center; color: #2b8cbe;'>Plot</h4>''', unsafe_allow_html=True)

tests/report_examples/Basic_example_vuegen_demo_notebook/streamlit_report/sections/Markdown/All_Markdown.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import streamlit as st
21
import requests
2+
import streamlit as st
33

44
st.markdown('''<h3 style='text-align: center; color: #023558;'>All Markdown</h3>''', unsafe_allow_html=True)
55
st.markdown('''<h4 style='text-align: center; color: #2b8cbe;'>Readme</h4>''', unsafe_allow_html=True)

tests/report_examples/Basic_example_vuegen_demo_notebook/streamlit_report/sections/Networks/Interactive_Networks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import streamlit as st
21
import requests
2+
import streamlit as st
33

44
st.markdown('''<h3 style='text-align: center; color: #023558;'>Interactive Networks</h3>''', unsafe_allow_html=True)
55
st.markdown('''<p style='text-align: center; color: #000000;'>Optional description for subsection.

tests/report_examples/Basic_example_vuegen_demo_notebook/streamlit_report/sections/Plots/Interactive_Plots.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import altair as alt
12
import json
2-
import streamlit as st
33
import requests
4-
import altair as alt
4+
import streamlit as st
55

66
st.markdown('''<h3 style='text-align: center; color: #023558;'>Interactive Plots</h3>''', unsafe_allow_html=True)
77
st.markdown('''<p style='text-align: center; color: #000000;'>Optional description for section.

0 commit comments

Comments
 (0)