A collection of helper functions to integrate with Jupyter/IPython and CLI commands for working with Kedro catalog.
Function | convert |
Convert selected or all notebooks found in a Kedro project to Kedro code, by exporting code from the appropriately-tagged cells: Cells tagged as node will be copied over to a Python file matching the name of the notebook, under ... |
Function | jupyter |
Open Jupyter Notebook / Lab with project specific variables loaded, or convert notebooks into Kedro code. |
Function | jupyter |
Undocumented |
Function | jupyter |
Open Jupyter Lab with project specific variables loaded. |
Function | jupyter |
Open Jupyter Notebook with project specific variables loaded. |
Constant | CONVERT |
Undocumented |
Constant | OVERWRITE |
Undocumented |
Function | _append |
Undocumented |
Function | _create |
Creates an IPython kernel for the kedro project. If one with the same kernel_name exists already it will be replaced. |
Function | _export |
Copy code from Jupyter cells into nodes in src/<package_name>/nodes/, under filename with same name as notebook. |
@click.option(
@click.option(
@click.argument(
@env_option
@click.pass_obj
def convert_notebook(metadata:
ProjectMetadata
, all_flag, overwrite_flag, filepath, env, **kwargs):
(source)
¶
Convert selected or all notebooks found in a Kedro project
to Kedro code, by exporting code from the appropriately-tagged cells:
Cells tagged as node
will be copied over to a Python file matching
the name of the notebook, under <source_dir>/<package_name>/nodes
.
Note: Make sure your notebooks have unique names!
FILEPATH: Path(s) to exact notebook file(s) to be converted. Both
relative and absolute paths are accepted.
Should not be provided if --all flag is already present. (DEPRECATED)
Open Jupyter Notebook / Lab with project specific variables loaded, or convert notebooks into Kedro code.
@env_option
@click.pass_obj
def jupyter_lab(metadata:
ProjectMetadata
, env, args, **kwargs):
(source)
¶
Open Jupyter Lab with project specific variables loaded.
@env_option
@click.pass_obj
def jupyter_notebook(metadata:
ProjectMetadata
, env, args, **kwargs):
(source)
¶
Open Jupyter Notebook with project specific variables loaded.
Undocumented
Value |
|
Undocumented
Value |
|
Creates an IPython kernel for the kedro project. If one with the same kernel_name exists already it will be replaced.
Installs the default IPython kernel (which points towards sys.executable
)
and customises it to make the launch command load the kedro extension.
This is equivalent to the method recommended for creating a custom IPython kernel
on the CLI: https://ipython.readthedocs.io/en/stable/install/kernel_install.html.
On linux this creates a directory ~/.local/share/jupyter/kernels/{kernel_name} containing kernel.json, logo-32x32.png, logo-64x64.png and logo-svg.svg. An example kernel.json looks as follows:
- {
- "argv": [
- "/Users/antony_milne/miniconda3/envs/spaceflights/bin/python", "-m", "ipykernel_launcher", "-f", "{connection_file}", "--ext", "kedro.ipython"
], "display_name": "Kedro (spaceflights)", "language": "python", "metadata": {
"debugger": false
}
}
Parameters | |
kernelstr | Name of the kernel to create. |
displaystr | Kernel name as it is displayed in the UI. |
Raises | |
KedroCliError | When kernel cannot be setup. |
Copy code from Jupyter cells into nodes in src/<package_name>/nodes/, under filename with same name as notebook.
Parameters | |
filepath:Path | Path to Jupyter notebook file |
outputPath | Path where notebook cells' source code will be exported |
Raises | |
KedroCliError | When provided a filepath that cannot be read as a Jupyer notebook and loaded into json format. |