How to use the tuna.cli.main function in tuna

To help you get started, we’ve selected a few tuna examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nschloe / tuna / tuna / magics.py View on Github external
def tuna(line: str, cell: Optional[str] = None) -> HTML:
    ip = get_ipython()  # noqa: F821
    with tempfile.TemporaryDirectory() as tmp_dir:
        prun_fname = f"{tmp_dir}/prun"
        prun_line = f"-q -D {prun_fname}"
        with capture_output():
            ip.run_cell_magic("prun", prun_line, cell if cell is not None else line)
        args = [prun_fname, "-o", tmp_dir, "--no-browser"]
        tuna_main(args)
        return _display_tuna(tmp_dir)