Skip to content

Commit 50c53a7

Browse files
committed
✨ vuegen pkg - package can be imported
- relative import except in main script (will be renamed __main__ and added as an entry point)
1 parent 7f668f8 commit 50c53a7

File tree

9 files changed

+49
-26
lines changed

9 files changed

+49
-26
lines changed

README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,24 @@ Also, the class diagram for the project is presented below to illustrate the arc
3434
</p>
3535

3636
## Installation
37-
......
37+
38+
You can install the package for development from this repository by running the following command:
39+
40+
```bash
41+
pip install -e path/to/vuegen # specify location
42+
pip install -e . # in case you pwd is in the vuegen directory
43+
```
3844

3945
## Execution
40-
``` shell
46+
47+
```bash
4148
python vuegen/main.py --config report_config_micw2graph.yaml --report_type streamlit
4249
```
50+
4351
The current report types are streamlit, html, pdf, docx, odt, revealjs, pptx, and jupyter.
4452

4553
## Contact
4654
If you have comments or suggestions about this project, you can [open an issue][issues] in this repository.
4755

4856
[issues]: https://github.com/Multiomics-Analytics-Group/vuegen/issues/new
49-
[streamlit]: https://streamlit.io/
57+
[streamlit]: https://streamlit.io/

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
[tool.poetry]
2-
name = "report-generator"
2+
name = "vuegen"
33
version = "0.1.0"
44
description = "Module to generate automatic web interface reports with visualizations"
55
authors = ["MoNA group"]
66
license = "MIT"
77
readme = "README.md"
8+
repository = "https://github.com/Multiomics-Analytics-Group/vuegen"
89

910
[tool.poetry.dependencies]
1011
python = ">=3.9,<3.9.7 || >3.9.7,<4.0"

vuegen/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from importlib.metadata import version
2+
3+
__version__ = version("vuegen")

vuegen/config_manager.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import report as r
2-
from utils import get_logger, assert_enum_value
1+
from . import report as r
2+
from .utils import assert_enum_value, get_logger
3+
34

45
class ConfigManager:
56
"""
@@ -260,4 +261,4 @@ def _create_chatbot_component(self, component_data: dict) -> r.ChatBot:
260261
caption = component_data.get('caption'),
261262
headers = component_data.get('headers'),
262263
params = component_data.get('params')
263-
)
264+
)

vuegen/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import report_generator
2-
from utils import get_logger, load_yaml_config, get_args
1+
from vuegen import report_generator
2+
from vuegen.utils import get_args, get_logger, load_yaml_config
33

44
if __name__ == '__main__':
55
# Parse command-line arguments

vuegen/quarto_reportview.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
import os
22
import subprocess
3-
import report as r
43
from typing import List
4+
55
import networkx as nx
66
import pandas as pd
7-
from utils import create_folder, is_url
7+
8+
from . import report as r
9+
from .utils import create_folder, is_url
10+
811

912
class QuartoReportView(r.ReportView):
1013
"""

vuegen/report.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
1+
import json
2+
import logging
13
import os
24
from abc import ABC, abstractmethod
35
from dataclasses import dataclass, field
4-
from typing import ClassVar
56
from enum import StrEnum, auto
6-
from typing import List, Optional
7+
from typing import ClassVar, List, Optional
8+
9+
import matplotlib.pyplot as plt
710
import networkx as nx
811
import pandas as pd
9-
import logging
1012
import requests
11-
import json
12-
import matplotlib.pyplot as plt
1313
from pyvis.network import Network
14-
from utils import cyjs_to_networkx, pyvishtml_to_networkx, fetch_file_stream
14+
15+
from .utils import cyjs_to_networkx, fetch_file_stream, pyvishtml_to_networkx
16+
1517

1618
class ReportType(StrEnum):
1719
STREAMLIT = auto()

vuegen/report_generator.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
from streamlit_reportview import StreamlitReportView
2-
from quarto_reportview import QuartoReportView
3-
from config_manager import ConfigManager
4-
from utils import assert_enum_value
5-
from report import ReportType
61
import logging
72

3+
from .config_manager import ConfigManager
4+
from .quarto_reportview import QuartoReportView
5+
from .report import ReportType
6+
from .streamlit_reportview import StreamlitReportView
7+
from .utils import assert_enum_value
8+
9+
810
def get_report(config: dict, report_type: str, logger: logging.Logger) -> None:
911
"""
1012
Generate and run a report based on the specified engine.
@@ -45,4 +47,4 @@ def get_report(config: dict, report_type: str, logger: logging.Logger) -> None:
4547
report_type=report_type
4648
)
4749
quarto_report.generate_report()
48-
quarto_report.run_report()
50+
quarto_report.run_report()

vuegen/streamlit_reportview.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
import report as r
21
import os
32
import subprocess
43
from typing import List
4+
55
import pandas as pd
6-
from utils import create_folder, is_url
6+
7+
from . import report as r
8+
from .utils import create_folder, is_url
9+
710

811
class StreamlitReportView(r.WebAppReportView):
912
"""
@@ -658,4 +661,4 @@ def _generate_component_imports(self, component: r.Component) -> List[str]:
658661
component_imports.extend(components_imports['chatbot'])
659662

660663
# Return the list of import statements
661-
return component_imports
664+
return component_imports

0 commit comments

Comments
 (0)