def test_fix_matplotlib_crash(self, _1, _2): """Test that bootstrap.run sets the matplotlib backend to "Agg" if config.runner.fixMatplotlib=True. """ # TODO: Find a proper way to mock sys.platform ORIG_PLATFORM = sys.platform for platform, do_fix in [("darwin", True), ("linux2", True)]: sys.platform = platform matplotlib.use("pdf", force=True) config._set_option("runner.fixMatplotlib", True, "test") bootstrap.run("/not/a/script", "", []) if do_fix: self.assertEqual("agg", matplotlib.get_backend().lower()) else: self.assertEqual("pdf", matplotlib.get_backend().lower()) # Reset matplotlib.use("pdf", force=True) config._set_option("runner.fixMatplotlib", False, "test") bootstrap.run("/not/a/script", "", []) self.assertEqual("pdf", matplotlib.get_backend().lower()) sys.platform = ORIG_PLATFORM
def demo(): try: from streamlit.bootstrap import run run( Path(__file__).parent / "contrib" / "streamlit" / "demo.py", "", "") except ImportError: print("(!) Too run the demo you need streamlit installed.") print("(!) Fix it by running `pip install streamlit`.")
def test_app_debug(): """ For manual debugging via breakpoints. Will open browser window with http://localhost:8503/ and stop at the set breakpoint. If the breakpoint is in code after the "Show preview" click, needs to be triggered by manually clicking "Show preview" just like regular usage. """ script_name = "app/main.py" bootstrap.run(script_name, f"run.py {script_name}", [])
def webserver(): """Start the Component UI and API""" api_process = Process(target=run_api) api_process.start() ui_script = Path( local_typhoon_path()).parent / 'component_ui/component_builder.py' try: bootstrap.run(str(ui_script), f'run.py {ui_script}', [], {}) finally: api_process.terminate() api_process.join()
def _main_run(file, args=[]): Credentials.get_current().check_activated(auto_resolve=True) import streamlit.bootstrap as bootstrap import sys # We don't use args ourselves. We just allow people to pass them so their # script can handle them via sys.argv or whatever. # IMPORTANT: This means we should treat argv carefully inside our code! sys.argv = [file] + list(args) bootstrap.run(file)
def demo(): """ 🌟 Launch streamlit demo. """ try: from streamlit.bootstrap import run run(Path(__file__).parent / "contrib" / "streamlit" / "demo.py", "", "") except ImportError: console.print("(!) Too run the demo you need streamlit installed.") console.print("(!) Fix it by running `pip install autogoal[streamlit]`.")
def _main_run(file, args=[]): command_line = _get_command_line_as_string() # Set a global flag indicating that we're "within" streamlit. streamlit._is_running_with_streamlit = True # Check credentials. check_credentials() # Notify if streamlit is out of date. if version.should_show_new_version_notice(): click.echo(NEW_VERSION_TEXT) bootstrap.run(file, command_line, args)
def _main_run(file, args=None, flag_options=None): if args is None: args = [] if flag_options is None: flag_options = {} command_line = _get_command_line_as_string() # Set a global flag indicating that we're "within" streamlit. streamlit._is_running_with_streamlit = True check_credentials() bootstrap.run(file, command_line, args, flag_options)
def _main_run(file, args=None, flag_options=None): if args is None: args = [] if flag_options is None: flag_options = {} command_line = _get_command_line_as_string() # Set a global flag indicating that we're "within" streamlit. streamlit._is_running_with_streamlit = True check_credentials() if version.should_show_new_version_notice(): click.echo(NEW_VERSION_TEXT) bootstrap.run(file, command_line, args, flag_options)
def _main_run(file, args=None): if args is None: args = [] # Set a global flag indicating that we're "within" streamlit. streamlit._is_running_with_streamlit = True # Check credentials. Credentials.get_current().check_activated(auto_resolve=True) # Notify if streamlit is out of date. if version.should_show_new_version_notice(): click.echo(NEW_VERSION_TEXT) # We don't use args ourselves. We just allow people to pass them so their # script can handle them via sys.argv or whatever. # IMPORTANT: This means we should treat argv carefully inside our code! import sys sys.argv = [file] + list(args) bootstrap.run(file)
from streamlit import bootstrap real_script = "honey-bee-health-detection-with-cnn.py" bootstrap.run(real_script, f'run.py {real_script}', [])
def run(): path = (Path(__file__).parent / "interface.py").absolute() arg1 = sys.argv[1] bootstrap.run(path, command_line=os.getcwd(), args={arg1})
def main(): analytical_dashboard = 'analytical_dashboard.py' #authors_dashboard = 'dashboards/author_search_app.py' bootstrap.run(analytical_dashboard, f'run.py {analytical_dashboard}', [])
def run(argv=None): if argv is None: argv = [] app_script = str(Path(__file__).with_name('app.py')) bootstrap.run(app_script, f'run {app_script}', argv)
def main(): load_config_options(CONFIG) run(_backend_web.__file__, "", [], CONFIG)
def main(data): all_sites = mod.acquire(data) scored_texts = mod.final_dataframe(all_sites) wra.score_deviation_func(scored_texts) dashboard = 'analytical_dashboard.py' bootstrap.run(dashboard, f'run.py {dashboard}', [])