Пример #1
0
    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
Пример #2
0
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`.")
Пример #3
0
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}", [])
Пример #4
0
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()
Пример #5
0
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)
Пример #6
0
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]`.")
Пример #7
0
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)
Пример #8
0
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)
Пример #9
0
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)
Пример #10
0
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)
Пример #11
0
from streamlit import bootstrap

real_script = "honey-bee-health-detection-with-cnn.py"

bootstrap.run(real_script, f'run.py {real_script}', [])
Пример #12
0
def run():
    path = (Path(__file__).parent / "interface.py").absolute()
    arg1 = sys.argv[1]
    bootstrap.run(path, command_line=os.getcwd(), args={arg1})
Пример #13
0
def main():

    analytical_dashboard = 'analytical_dashboard.py'
    #authors_dashboard = 'dashboards/author_search_app.py'
    bootstrap.run(analytical_dashboard, f'run.py {analytical_dashboard}', [])
Пример #14
0
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)
Пример #15
0
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}', [])