aerosandbox.tools.python
Submodules
Functions
convert_ipynb_to_py(input_file, output_file) | Reads an input Jupyter notebook (.ipynb) and converts it to a Python file (.py) |
convert_ipynb_to_py(input_file, output_file) | Reads an input Jupyter notebook (.ipynb) and converts it to a Python file (.py) |
run_python_file(path) | Executes a Python file from a path. |
run_all_python_files(path[, recursive, verbose]) | Executes all Python files and Jupyter Notebooks in a directory. |
lazy_import(name) | Allows you to lazily import a module. |
Package Contents
aerosandbox.tools.python.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!
Parameters:
: - **input\_file** (*pathlib.Path*) – File path
- **output\_file** (*pathlib.Path*) – File path
Return type:
: None
Returns: Noneaerosandbox.tools.python.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!
Parameters:
: - **input\_file** (*pathlib.Path*) – File path
- **output\_file** (*pathlib.Path*) – File path
Return type:
: None
Returns: Noneaerosandbox.tools.python.run_python_file(path) : Executes a Python file from a path. :param path: File path
Returns: None
Parameters:
: **path** (*pathlib.Path*) –
Return type:
: Noneaerosandbox.tools.python.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
Parameters:
: **path** (*pathlib.Path*) –
Return type:
: Noneaerosandbox.tools.python.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.
Parameters:
: **name** – The package name
Returns: The module itself, to be loaded on first use.