Skip to content

Commit 6e8374d

Browse files
committed
🎨 format example notebooks in documentation with black
1 parent 33ffc65 commit 6e8374d

File tree

3 files changed

+513
-312
lines changed

3 files changed

+513
-312
lines changed

.github/workflows/cdci.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
branches: [main]
88
release:
99
types: [published]
10-
10+
1111
jobs:
1212
test:
1313
name: Unittests+streamlit
@@ -17,14 +17,16 @@ jobs:
1717
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
1818
steps:
1919
- uses: actions/checkout@v4
20-
- uses: psf/black@stable
20+
- uses: psf/black@stable
21+
# with:
22+
# jupyter: true
2123
- uses: isort/isort-action@v1
2224
- name: Set up Python ${{ matrix.python-version }}
2325
uses: actions/setup-python@v5
2426
with:
2527
python-version: ${{ matrix.python-version }}
26-
cache: 'pip' # caching pip dependencies
27-
cache-dependency-path: '**/pyproject.toml'
28+
cache: "pip" # caching pip dependencies
29+
cache-dependency-path: "**/pyproject.toml"
2830
- name: Install dependencies
2931
run: |
3032
python -m pip install --upgrade pip
@@ -37,7 +39,7 @@ jobs:
3739
cd docs
3840
vuegen --directory example_data/Earth_microbiome_vuegen_demo_notebook
3941
vuegen --config example_data/Earth_microbiome_vuegen_demo_notebook/Earth_microbiome_vuegen_demo_notebook_config.yaml
40-
42+
4143
other-reports:
4244
name: Integration tests
4345
runs-on: ubuntu-latest
@@ -50,8 +52,8 @@ jobs:
5052
uses: actions/setup-python@v5
5153
with:
5254
python-version: ${{ matrix.python-version }}
53-
cache: 'pip' # caching pip dependencies
54-
cache-dependency-path: '**/pyproject.toml'
55+
cache: "pip" # caching pip dependencies
56+
cache-dependency-path: "**/pyproject.toml"
5557
- name: Install dependencies
5658
run: |
5759
pip install --upgrade pip
@@ -110,7 +112,7 @@ jobs:
110112

111113
steps:
112114
- uses: actions/checkout@v4
113-
115+
114116
- uses: actions/setup-python@v5
115117
with:
116118
python-version: "3.11"

docs/vuegen_basic_case_study.ipynb

Lines changed: 52 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
},
6868
"outputs": [],
6969
"source": [
70-
"# Vuegen library \n",
70+
"# Vuegen library\n",
7171
"%pip install vuegen"
7272
]
7373
},
@@ -78,6 +78,7 @@
7878
"outputs": [],
7979
"source": [
8080
"import os\n",
81+
"\n",
8182
"IN_COLAB = \"COLAB_GPU\" in os.environ"
8283
]
8384
},
@@ -164,7 +165,9 @@
164165
"source": [
165166
"# Generate the report\n",
166167
"report_type = \"streamlit\"\n",
167-
"report_generator.get_report(dir_path = base_output_dir, report_type = report_type, logger = None)"
168+
"report_generator.get_report(\n",
169+
" dir_path=base_output_dir, report_type=report_type, logger=None\n",
170+
")"
168171
]
169172
},
170173
{
@@ -185,14 +188,20 @@
185188
"# run_streamlit = True # uncomment line to run the streamlit report\n",
186189
"# Launch the Streamlit report depneding on the platform\n",
187190
"if not IN_COLAB and run_streamlit:\n",
188-
" !streamlit run streamlit_report/sections/report_manager.py\n",
191+
" !streamlit run streamlit_report/sections/report_manager.py\n",
189192
"elif run_streamlit:\n",
190-
" # see: https://discuss.streamlit.io/t/how-to-launch-streamlit-app-from-google-colab-notebook/42399\n",
191-
" print(\"Password/Enpoint IP for localtunnel is:\",urllib.request.urlopen('https://ipv4.icanhazip.com').read().decode('utf8').strip(\"\\n\"))\n",
192-
" # Run the Streamlit app in the background\n",
193-
" !streamlit run streamlit_report/sections/report_manager.py --server.address=localhost &>/content/logs.txt &\n",
194-
" # Expose the Streamlit app on port 8501\n",
195-
" !npx localtunnel --port 8501 --subdomain vuegen-demo\n",
193+
" # see: https://discuss.streamlit.io/t/how-to-launch-streamlit-app-from-google-colab-notebook/42399\n",
194+
" print(\n",
195+
" \"Password/Enpoint IP for localtunnel is:\",\n",
196+
" urllib.request.urlopen(\"https://ipv4.icanhazip.com\")\n",
197+
" .read()\n",
198+
" .decode(\"utf8\")\n",
199+
" .strip(\"\\n\"),\n",
200+
" )\n",
201+
" # Run the Streamlit app in the background\n",
202+
" !streamlit run streamlit_report/sections/report_manager.py --server.address=localhost &>/content/logs.txt &\n",
203+
" # Expose the Streamlit app on port 8501\n",
204+
" !npx localtunnel --port 8501 --subdomain vuegen-demo\n",
196205
"else:\n",
197206
" print(\"Streamlit report not executed, set run_streamlit to True to run the report\")"
198207
]
@@ -212,7 +221,9 @@
212221
"source": [
213222
"# Generate the report\n",
214223
"report_type = \"html\"\n",
215-
"report_generator.get_report(dir_path = base_output_dir, report_type = report_type, logger = None)"
224+
"report_generator.get_report(\n",
225+
" dir_path=base_output_dir, report_type=report_type, logger=None\n",
226+
")"
216227
]
217228
},
218229
{
@@ -239,11 +250,15 @@
239250
"vuegen_logo_path = \"https://raw.githubusercontent.com/Multiomics-Analytics-Group/vuegen/main/docs/images/vuegen_logo.svg\"\n",
240251
"\n",
241252
"# Load the YAML file\n",
242-
"config_path = os.path.join(base_output_dir, \"Basic_example_vuegen_demo_notebook_config.yaml\")\n",
253+
"config_path = os.path.join(\n",
254+
" base_output_dir, \"Basic_example_vuegen_demo_notebook_config.yaml\"\n",
255+
")\n",
243256
"config = load_yaml_config(config_path)\n",
244257
"\n",
245258
"# Update the logo and graphical abstract with the URL\n",
246-
"config[\"report\"].update({\"logo\": vuegen_logo_path, \"graphical_abstract\": vuegen_logo_path})"
259+
"config[\"report\"].update(\n",
260+
" {\"logo\": vuegen_logo_path, \"graphical_abstract\": vuegen_logo_path}\n",
261+
")"
247262
]
248263
},
249264
{
@@ -261,15 +276,17 @@
261276
"source": [
262277
"# Update the description for the EDA section\n",
263278
"for section in config[\"sections\"]:\n",
264-
" if section[\"title\"] == \"Plots\": \n",
279+
" if section[\"title\"] == \"Plots\":\n",
265280
" section[\"description\"] = \"This section contains example plots\"\n",
266281
"\n",
267282
"# Update the description for the alpha diversity subsection from the Metagenomics section\n",
268283
"for section in config[\"sections\"]:\n",
269284
" if section[\"title\"] == \"Dataframes\":\n",
270285
" for subsection in section[\"subsections\"]:\n",
271286
" if subsection[\"title\"] == \"All Formats\":\n",
272-
" subsection[\"description\"] = \"This subsection contains example dataframes.\"\n"
287+
" subsection[\"description\"] = (\n",
288+
" \"This subsection contains example dataframes.\"\n",
289+
" )"
273290
]
274291
},
275292
{
@@ -288,11 +305,11 @@
288305
"# Define new plot with a URL as the file path\n",
289306
"vuegen_abst_fig = {\n",
290307
" \"title\": \"Graphical overview of VueGen’s workflow and components\",\n",
291-
" \"file_path\": \"https://raw.githubusercontent.com/Multiomics-Analytics-Group/vuegen/main/docs/images/vuegen_graph_abstract.png\", \n",
308+
" \"file_path\": \"https://raw.githubusercontent.com/Multiomics-Analytics-Group/vuegen/main/docs/images/vuegen_graph_abstract.png\",\n",
292309
" \"description\": \"\",\n",
293310
" \"caption\": \"The diagram illustrates the processing pipeline of VueGen, starting from either a directory or a YAML configuration file. Reports consist of hierarchical sections and subsections, each containing various components such as plots, dataframes, Markdown, HTML, and data retrieved via API calls.\",\n",
294311
" \"component_type\": \"plot\",\n",
295-
" \"plot_type\": \"static\"\n",
312+
" \"plot_type\": \"static\",\n",
296313
"}\n",
297314
"\n",
298315
"# Add the plot to the Sample Provenance subsection in the EDA section\n",
@@ -324,7 +341,9 @@
324341
"source": [
325342
"# Test the changes by generarating the report from the modified YAML file\n",
326343
"report_type = \"streamlit\"\n",
327-
"report_generator.get_report(config_path = config_path, report_type = report_type, logger = None)"
344+
"report_generator.get_report(\n",
345+
" config_path=config_path, report_type=report_type, logger=None\n",
346+
")"
328347
]
329348
},
330349
{
@@ -337,14 +356,20 @@
337356
"# run_streamlit = True # uncomment line to run the streamlit report\n",
338357
"# Launch the Streamlit report depneding on the platform\n",
339358
"if not IN_COLAB and run_streamlit:\n",
340-
" !streamlit run streamlit_report/sections/report_manager.py\n",
359+
" !streamlit run streamlit_report/sections/report_manager.py\n",
341360
"elif run_streamlit:\n",
342-
" # see: https://discuss.streamlit.io/t/how-to-launch-streamlit-app-from-google-colab-notebook/42399\n",
343-
" print(\"Password/Enpoint IP for localtunnel is:\",urllib.request.urlopen('https://ipv4.icanhazip.com').read().decode('utf8').strip(\"\\n\"))\n",
344-
" # Run the Streamlit app in the background\n",
345-
" !streamlit run streamlit_report/sections/report_manager.py --server.address=localhost &>/content/logs.txt &\n",
346-
" # Expose the Streamlit app on port 8501\n",
347-
" !npx localtunnel --port 8501 --subdomain vuegen-demo\n",
361+
" # see: https://discuss.streamlit.io/t/how-to-launch-streamlit-app-from-google-colab-notebook/42399\n",
362+
" print(\n",
363+
" \"Password/Enpoint IP for localtunnel is:\",\n",
364+
" urllib.request.urlopen(\"https://ipv4.icanhazip.com\")\n",
365+
" .read()\n",
366+
" .decode(\"utf8\")\n",
367+
" .strip(\"\\n\"),\n",
368+
" )\n",
369+
" # Run the Streamlit app in the background\n",
370+
" !streamlit run streamlit_report/sections/report_manager.py --server.address=localhost &>/content/logs.txt &\n",
371+
" # Expose the Streamlit app on port 8501\n",
372+
" !npx localtunnel --port 8501 --subdomain vuegen-demo\n",
348373
"else:\n",
349374
" print(\"Streamlit report not executed, set run_streamlit to True to run the report\")"
350375
]
@@ -364,7 +389,9 @@
364389
"source": [
365390
"# Test the changes by generarating the report from the modified YAML file\n",
366391
"report_type = \"html\"\n",
367-
"report_generator.get_report(config_path = config_path, report_type = report_type, logger = None)"
392+
"report_generator.get_report(\n",
393+
" config_path=config_path, report_type=report_type, logger=None\n",
394+
")"
368395
]
369396
}
370397
],

0 commit comments

Comments
 (0)