Files
OpenBB/openbb_terminal/dashboards/streamlit.py
teh_coderer 0e9abc3a84 Feature/ Voila to Streamlit Dashboards (#4755)
* idk

* g

* idk

* init

* revert old push

* pylint

* ruff

* update

* mypy

* tests

* LF

* tests

* Update Futures.py

* tests?

* fix intraday candle breaks

* tests????

* remove matplotlib from settings controller, autocomplete for flair cmd

* Update test_settings_controller.py

* remove streamlit activate warnings as it's not needed anymore

* bump pywry

* fix daily date gaps

* Update pytrends

* Update terminal.spec

* Update terminal.spec

* Update terminal.spec

* Update macos-build.yml

* Update macos-build.yml

* Update windows10_build.yml

* Update terminal.spec

* streamlit

* streamlit configs

* test

* lint

* cmd source in charts

* Update dashboards_controller.py

* Update dashboards_controller.py

* Update backend.py

---------

Co-authored-by: James Maslek <jmaslek11@gmail.com>
2023-04-12 20:38:56 +00:00

41 lines
1.1 KiB
Python

import re
import sys
from pathlib import Path
import streamlit.web.bootstrap
from openbb_terminal.core.config.paths import REPOSITORY_DIRECTORY
def main():
# pylint: disable=E1101,W0212
parent_path = Path(sys._MEIPASS) if hasattr(sys, "frozen") else REPOSITORY_DIRECTORY # type: ignore
filepath = Path(__file__).parent / "stream" / "Forecasting.py"
file = filepath.relative_to(parent_path).as_posix()
cmdline = " ".join(sys.argv)
port = re.findall(r"--port=(\d+)", cmdline)
port = int(port[0]) if port else 8501
flag_options = {
"server.port": port,
"server.headless": True,
"global.developmentMode": False,
"server.enableCORS": False,
"server.enableXsrfProtection": False,
"browser.serverAddress": "localhost",
}
streamlit.web.bootstrap.load_config_options(flag_options=flag_options)
flag_options["_is_running_with_streamlit"] = True
streamlit.web.bootstrap.run(
str(file),
"streamlit run",
[],
flag_options,
)
if __name__ == "__main__":
main()