aerosandbox.tools.python ======================== .. py:module:: aerosandbox.tools.python Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/aerosandbox/tools/python/execution/index /autoapi/aerosandbox/tools/python/importing/index /autoapi/aerosandbox/tools/python/io/index Functions --------- .. autoapisummary:: aerosandbox.tools.python.convert_ipynb_to_py aerosandbox.tools.python.convert_ipynb_to_py aerosandbox.tools.python.run_python_file aerosandbox.tools.python.run_all_python_files aerosandbox.tools.python.lazy_import Package Contents ---------------- .. py:function:: convert_ipynb_to_py(input_file, output_file) Reads an input Jupyter notebook (.ipynb) and converts it to a Python file (.py) Tried using `jupyter nbconvert`, but that is SO SLOW, like 3 seconds per notebook! It's just json parsing, this should *not* take more than a few milliseconds - come on, Jupyter! :param input_file: File path :param output_file: File path Returns: None .. py:function:: convert_ipynb_to_py(input_file, output_file) Reads an input Jupyter notebook (.ipynb) and converts it to a Python file (.py) Tried using `jupyter nbconvert`, but that is SO SLOW, like 3 seconds per notebook! It's just json parsing, this should *not* take more than a few milliseconds - come on, Jupyter! :param input_file: File path :param output_file: File path Returns: None .. py:function:: run_python_file(path) Executes a Python file from a path. :param path: File path Returns: None .. py:function:: run_all_python_files(path, recursive=True, verbose=True) Executes all Python files and Jupyter Notebooks in a directory. :param path: A Path-type object (Path from built-in pathlib) representing a filepath :param recursive: Executes recursively (e.g. searches all subfolders too) Returns: None .. py:function:: lazy_import(name) Allows you to lazily import a module. Usage: >>> asb = lazy_import("aerosandbox") # Runs instantly >>> asb.Airplane() # When this is called, ASB will be loaded. :param name: The package name Returns: The module itself, to be loaded on first use.