Giulio Morina
08/17/2023, 11:33 AM%load_ext kedro.ipython
but then when I run %reload_kedro <folder_root>
I get “UsageError: Line magic function %reload_kedro
not found.”
Feels like I am missing something obvious, any tips?datajoely
08/17/2023, 11:55 AMimport kedro
okay?Giulio Morina
08/17/2023, 12:04 PMimport kedro
works finedatajoely
08/17/2023, 12:35 PMGiulio Morina
08/17/2023, 12:36 PMdatajoely
08/17/2023, 12:38 PM%load_ext kedro.ipython
Giulio Morina
08/17/2023, 12:39 PMWARNING Kedro extension was registered but couldn't find a Kedro project. Make
sure you run '%reload_kedro <project_root>'.
datajoely
08/17/2023, 12:40 PM%reload_kedro path/to/proj
Giulio Morina
08/17/2023, 12:42 PM%reload_kedro
line magic it says that the line magic %reload_kedro
is not found.datajoely
08/17/2023, 12:43 PM%reload_kedro
Nok Lam Chan
08/17/2023, 1:00 PM%load_ext kedro.ipython
does this work? If not then %load_ext kedro.extras.extensions.ipython
Can you do %reload_kedro
after you run the above command?Giulio Morina
08/17/2023, 1:04 PM%load_ext kedro.ipython
and %load_ext kedro.extras.extensions.ipython
work, but %reload_kedro
does not work after running either of the commands aboveNok Lam Chan
08/17/2023, 1:08 PMreload_kedro
doesn’t exist after you do %load_ext
?Giulio Morina
08/17/2023, 1:08 PMNok Lam Chan
08/17/2023, 1:09 PMtree
in the root directory. I need to know these
• where is the pyproject.toml
• where is the notebookdef load_ipython_extension(ipython):
"""
Main entry point when %load_ext kedro.ipython is executed, either manually or
automatically through `kedro ipython` or `kedro jupyter lab/notebook`.
IPython will look for this function specifically.
See <https://ipython.readthedocs.io/en/stable/config/extensions/index.html>
"""
ipython.register_magic_function(magic_reload_kedro, magic_name="reload_kedro")
if _find_kedro_project(Path.cwd()) is None:
logger.warning(
"Kedro extension was registered but couldn't find a Kedro project. "
"Make sure you run '%reload_kedro <project_root>'."
)
return
This is weird because from the log you show, the log is emitted after %reload_kedro
registered.from kedro.ipython import reload_kedro
reload_kedro(path)
This should also work.Giulio Morina
08/18/2023, 1:37 PMValueError: Given configuration path either does not exist or is not a valid directory: src
Nok Lam Chan
08/18/2023, 2:48 PMtree
command to show how is it structured?
• where is your pyproject.toml
• where is your notebook fileGiulio Morina
08/18/2023, 2:56 PM.
├── analysis <- KEDRO PROJECT FOLDER
│ ├── README.md
│ ├── conf
│ │ ├── base
│ │ │ ├── catalog
│ │ │ │ └── main.yml
│ │ │ ├── globals.yml
│ │ │ ├── parameters.yml
│ ├── pyproject.toml
│ ├── setup.cfg
│ ├── src
│ │ ├── analysis
│ │ │ ├── extract_datasets.py
│ │ │ ├── hooks.py
│ │ │ ├── pipeline_registry.py
│ │ │ ├── settings.py
│ │ ├── <http://dev-requirements.in|dev-requirements.in>
│ │ ├── dev-requirements.txt
│ │ ├── <http://requirements.in|requirements.in>
│ │ ├── requirements.txt
│ │ ├── setup.py
├── notebooks
│ ├── test.ipynb <- NOTEBOOK
├── parameters.yaml
├── pyproject.toml
Nok Lam Chan
08/18/2023, 2:58 PMreload_kedro("../")
?pyproject.toml
to locate the root, not the src fileGiulio Morina
08/18/2023, 3:03 PMreload_kedro("../")
I get `
RuntimeError: There's no '[tool.kedro]' section in the 'pyproject.toml'. Please add '[tool.kedro]' section to the
file with appropriate configuration parameters.
as I believe it picks up the pyproject.toml in the root folder which is not the one in Kedro project.
If I do reload_kedro("../analysis")
then I get the previous error:
ValueError: Given configuration path either does not exist or is not a valid directory: src
Nok Lam Chan
08/18/2023, 3:08 PMpyproject.toml
indeed. This is a very good example 🙂 Let me run a few tests and get back to you.Giulio Morina
08/18/2023, 3:09 PMNok Lam Chan
08/18/2023, 3:21 PMreload_kedro
have a weak assumption that it is a Kedro Project. Right now you have a Python project outside, and within it there is a kedro project. So when it looks up to find pyproject.toml
it finds roots/pyproject.toml
rather than `analysis/pyproject.toml`(the kedro project)settings.py
or the conf_source
? I try to reproduce your error but I didn’t get a ValueError when I do reload_kedro("../analysis")
Giulio Morina
08/18/2023, 3:25 PM