We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Add `--conf-source` option to `kedro ipython`
## Description
Right now we can pass `env` and `params` as options with `kedro ipython` / `%reload_kedro`. Add `--conf-source` option as well.

## Context
User question from slack : 

> Speaking of  kedro ipython :
Is there a way to specify /override the  conf_source ? :slightly_smiling_face:

> My problem comes from the fact that we have a single pipeline / repo for all our clients.
To better enforce “tenant isolation”
I have organized conf and data as follow:
conf
└── client_A
    ├── base
    └── local
└── client_B
    ├── base
    └── local
data
├── client_A
│   └── 01_raw
│   └── 02_intermediate
│   └── ...
└── client_B
│   └── 01_raw
│   └── 02_intermediate
│   └── ...conf
I did so because I liked the idea of not being able to run the pipeline without being explicit about which client it should be done for…
(the structure above makes it so that kedro run without --conf-source will raise an error)
Another reason I did so (if I recall correctly) was to avoid having “duplicate keys” conflicts in the different yaml files across clients… 

## Possible Implementation
Changes to be made in `kedro/ipython/__init__.py`
PR for when `--conf-source` was added to `kedro run` - https://github.com/kedro-org/kedro/pull/2117


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `kedro/ipython/__init__.py`
Content:
```
1 """
2 This script creates an IPython extension to load Kedro-related variables in
3 local scope.
4 """
5 from __future__ import annotations
6 
7 import logging
8 import sys
9 from pathlib import Path
10 from typing import Any
11 
12 from IPython import get_ipython
13 from IPython.core.magic import needs_local_scope, register_line_magic
14 from IPython.core.magic_arguments import argument, magic_arguments, parse_argstring
15 
16 from kedro.framework.cli import load_entry_points
17 from kedro.framework.cli.project import PARAMS_ARG_HELP
18 from kedro.framework.cli.utils import ENV_HELP, _split_params
19 from kedro.framework.project import (
20     LOGGING,  # noqa
21     configure_project,
22     pipelines,
23 )
24 from kedro.framework.session import KedroSession
25 from kedro.framework.startup import _is_project, bootstrap_project
26 
27 logger = logging.getLogger(__name__)
28 
29 
30 def load_ipython_extension(ipython):
31     """
32     Main entry point when %load_ext kedro.ipython is executed, either manually or
33     automatically through `kedro ipython` or `kedro jupyter lab/notebook`.
34     IPython will look for this function specifically.
35     See https://ipython.readthedocs.io/en/stable/config/extensions/index.html
36     """
37     ipython.register_magic_function(magic_reload_kedro, magic_name="reload_kedro")
38 
39     if _find_kedro_project(Path.cwd()) is None:
40         logger.warning(
41             "Kedro extension was registered but couldn't find a Kedro project. "
42             "Make sure you run '%reload_kedro <project_root>'."
43         )
44         return
45 
46     reload_kedro()
47 
48 
49 @needs_local_scope
50 @magic_arguments()
51 @argument(
52     "path",
53     type=str,
54     help=(
55         "Path to the project root directory. If not given, use the previously set"
56         "project root."
57     ),
58     nargs="?",
59     default=None,
60 )
61 @argument("-e", "--env", type=str, default=None, help=ENV_HELP)
62 @argument(
63     "--params",
64     type=lambda value: _split_params(None, None, value),
65     default=None,
66     help=PARAMS_ARG_HELP,
67 )
68 def magic_reload_kedro(line: str, local_ns: dict[str, Any] = None):
69     """
70     The `%reload_kedro` IPython line magic.
71     See https://kedro.readthedocs.io/en/stable/notebooks_and_ipython/kedro_and_notebooks.html#reload-kedro-line-magic # noqa: line-too-long
72     for more.
73     """
74     args = parse_argstring(magic_reload_kedro, line)
75     reload_kedro(args.path, args.env, args.params, local_ns)
76 
77 
78 def reload_kedro(
79     path: str = None,
80     env: str = None,
81     extra_params: dict[str, Any] = None,
82     local_namespace: dict[str, Any] | None = None,
83 ) -> None:  # pragma: no cover
84     """Function that underlies the %reload_kedro Line magic. This should not be imported
85     or run directly but instead invoked through %reload_kedro."""
86 
87     project_path = _resolve_project_path(path, local_namespace)
88 
89     metadata = bootstrap_project(project_path)
90     _remove_cached_modules(metadata.package_name)
91     configure_project(metadata.package_name)
92 
93     session = KedroSession.create(
94         metadata.package_name, project_path, env=env, extra_params=extra_params
95     )
96     context = session.load_context()
97     catalog = context.catalog
98 
99     get_ipython().push(
100         variables={
101             "context": context,
102             "catalog": catalog,
103             "session": session,
104             "pipelines": pipelines,
105         }
106     )
107 
108     logger.info("Kedro project %s", str(metadata.project_name))
109     logger.info(
110         "Defined global variable 'context', 'session', 'catalog' and 'pipelines'"
111     )
112 
113     for line_magic in load_entry_points("line_magic"):
114         register_line_magic(needs_local_scope(line_magic))
115         logger.info("Registered line magic '%s'", line_magic.__name__)  # type: ignore
116 
117 
118 def _resolve_project_path(
119     path: str | None = None, local_namespace: dict[str, Any] | None = None
120 ) -> Path:
121     """
122     Resolve the project path to use with reload_kedro, updating or adding it
123     (in-place) to the local ipython Namespace (``local_namespace``) if necessary.
124 
125     Arguments:
126         path: the path to use as a string object
127         local_namespace: Namespace with local variables of the scope where the line
128             magic is invoked in a dict.
129     """
130     if path:
131         project_path = Path(path).expanduser().resolve()
132     else:
133         if local_namespace and "context" in local_namespace:
134             # noqa: protected-access
135             project_path = local_namespace["context"]._project_path
136         else:
137             project_path = _find_kedro_project(Path.cwd())
138         if project_path:
139             logger.info(
140                 "Resolved project path as: %s.\nTo set a different path, run "
141                 "'%%reload_kedro <project_root>'",
142                 project_path,
143             )
144 
145     # noqa: protected-access
146     if (
147         project_path
148         and local_namespace
149         and "context" in local_namespace
150         and project_path != local_namespace["context"]._project_path
151     ):
152         logger.info("Updating path to Kedro project: %s...", project_path)
153 
154     return project_path
155 
156 
157 def _remove_cached_modules(package_name):  # pragma: no cover
158     to_remove = [mod for mod in sys.modules if mod.startswith(package_name)]
159     # `del` is used instead of `reload()` because: If the new version of a module does not
160     # define a name that was defined by the old version, the old definition remains.
161     for module in to_remove:
162         del sys.modules[module]
163 
164 
165 def _find_kedro_project(current_dir: Path):  # pragma: no cover
166     while current_dir != current_dir.parent:
167         if _is_project(current_dir):
168             return current_dir
169         current_dir = current_dir.parent
170 
171     return None
172
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/kedro/ipython/__init__.py b/kedro/ipython/__init__.py
--- a/kedro/ipython/__init__.py
+++ b/kedro/ipython/__init__.py
@@ -14,7 +14,7 @@
 from IPython.core.magic_arguments import argument, magic_arguments, parse_argstring
 
 from kedro.framework.cli import load_entry_points
-from kedro.framework.cli.project import PARAMS_ARG_HELP
+from kedro.framework.cli.project import CONF_SOURCE_HELP, PARAMS_ARG_HELP
 from kedro.framework.cli.utils import ENV_HELP, _split_params
 from kedro.framework.project import (
     LOGGING,  # noqa
@@ -65,14 +65,17 @@
     default=None,
     help=PARAMS_ARG_HELP,
 )
-def magic_reload_kedro(line: str, local_ns: dict[str, Any] = None):
+@argument("--conf-source", type=str, default=None, help=CONF_SOURCE_HELP)
+def magic_reload_kedro(
+    line: str, local_ns: dict[str, Any] = None, conf_source: str = None
+):
     """
     The `%reload_kedro` IPython line magic.
     See https://kedro.readthedocs.io/en/stable/notebooks_and_ipython/kedro_and_notebooks.html#reload-kedro-line-magic # noqa: line-too-long
     for more.
     """
     args = parse_argstring(magic_reload_kedro, line)
-    reload_kedro(args.path, args.env, args.params, local_ns)
+    reload_kedro(args.path, args.env, args.params, local_ns, args.conf_source)
 
 
 def reload_kedro(
@@ -80,6 +83,7 @@
     env: str = None,
     extra_params: dict[str, Any] = None,
     local_namespace: dict[str, Any] | None = None,
+    conf_source: str = None,
 ) -> None:  # pragma: no cover
     """Function that underlies the %reload_kedro Line magic. This should not be imported
     or run directly but instead invoked through %reload_kedro."""
@@ -91,7 +95,11 @@
     configure_project(metadata.package_name)
 
     session = KedroSession.create(
-        metadata.package_name, project_path, env=env, extra_params=extra_params
+        metadata.package_name,
+        project_path,
+        env=env,
+        extra_params=extra_params,
+        conf_source=conf_source,
     )
     context = session.load_context()
     catalog = context.catalog

{"golden_diff": "diff --git a/kedro/ipython/__init__.py b/kedro/ipython/__init__.py\n--- a/kedro/ipython/__init__.py\n+++ b/kedro/ipython/__init__.py\n@@ -14,7 +14,7 @@\n from IPython.core.magic_arguments import argument, magic_arguments, parse_argstring\n \n from kedro.framework.cli import load_entry_points\n-from kedro.framework.cli.project import PARAMS_ARG_HELP\n+from kedro.framework.cli.project import CONF_SOURCE_HELP, PARAMS_ARG_HELP\n from kedro.framework.cli.utils import ENV_HELP, _split_params\n from kedro.framework.project import (\n     LOGGING,  # noqa\n@@ -65,14 +65,17 @@\n     default=None,\n     help=PARAMS_ARG_HELP,\n )\n-def magic_reload_kedro(line: str, local_ns: dict[str, Any] = None):\n+@argument(\"--conf-source\", type=str, default=None, help=CONF_SOURCE_HELP)\n+def magic_reload_kedro(\n+    line: str, local_ns: dict[str, Any] = None, conf_source: str = None\n+):\n     \"\"\"\n     The `%reload_kedro` IPython line magic.\n     See https://kedro.readthedocs.io/en/stable/notebooks_and_ipython/kedro_and_notebooks.html#reload-kedro-line-magic # noqa: line-too-long\n     for more.\n     \"\"\"\n     args = parse_argstring(magic_reload_kedro, line)\n-    reload_kedro(args.path, args.env, args.params, local_ns)\n+    reload_kedro(args.path, args.env, args.params, local_ns, args.conf_source)\n \n \n def reload_kedro(\n@@ -80,6 +83,7 @@\n     env: str = None,\n     extra_params: dict[str, Any] = None,\n     local_namespace: dict[str, Any] | None = None,\n+    conf_source: str = None,\n ) -> None:  # pragma: no cover\n     \"\"\"Function that underlies the %reload_kedro Line magic. This should not be imported\n     or run directly but instead invoked through %reload_kedro.\"\"\"\n@@ -91,7 +95,11 @@\n     configure_project(metadata.package_name)\n \n     session = KedroSession.create(\n-        metadata.package_name, project_path, env=env, extra_params=extra_params\n+        metadata.package_name,\n+        project_path,\n+        env=env,\n+        extra_params=extra_params,\n+        conf_source=conf_source,\n     )\n     context = session.load_context()\n     catalog = context.catalog\n", "issue": "Add `--conf-source` option to `kedro ipython`\n## Description\r\nRight now we can pass `env` and `params` as options with `kedro ipython` / `%reload_kedro`. Add `--conf-source` option as well.\r\n\r\n## Context\r\nUser question from slack : \r\n\r\n> Speaking of  kedro ipython :\r\nIs there a way to specify /override the  conf_source ? :slightly_smiling_face:\r\n\r\n> My problem comes from the fact that we have a single pipeline / repo for all our clients.\r\nTo better enforce \u201ctenant isolation\u201d\r\nI have organized conf and data as follow:\r\nconf\r\n\u2514\u2500\u2500 client_A\r\n    \u251c\u2500\u2500 base\r\n    \u2514\u2500\u2500 local\r\n\u2514\u2500\u2500 client_B\r\n    \u251c\u2500\u2500 base\r\n    \u2514\u2500\u2500 local\r\ndata\r\n\u251c\u2500\u2500 client_A\r\n\u2502   \u2514\u2500\u2500 01_raw\r\n\u2502   \u2514\u2500\u2500 02_intermediate\r\n\u2502   \u2514\u2500\u2500 ...\r\n\u2514\u2500\u2500 client_B\r\n\u2502   \u2514\u2500\u2500 01_raw\r\n\u2502   \u2514\u2500\u2500 02_intermediate\r\n\u2502   \u2514\u2500\u2500 ...conf\r\nI did so because I liked the idea of not being able to run the pipeline without being explicit about which client it should be done for\u2026\r\n(the structure above makes it so that kedro run without --conf-source will raise an error)\r\nAnother reason I did so (if I recall correctly) was to avoid having \u201cduplicate keys\u201d conflicts in the different yaml files across clients\u2026 \r\n\r\n## Possible Implementation\r\nChanges to be made in `kedro/ipython/__init__.py`\r\nPR for when `--conf-source` was added to `kedro run` - https://github.com/kedro-org/kedro/pull/2117\r\n\n", "before_files": [{"content": "\"\"\"\nThis script creates an IPython extension to load Kedro-related variables in\nlocal scope.\n\"\"\"\nfrom __future__ import annotations\n\nimport logging\nimport sys\nfrom pathlib import Path\nfrom typing import Any\n\nfrom IPython import get_ipython\nfrom IPython.core.magic import needs_local_scope, register_line_magic\nfrom IPython.core.magic_arguments import argument, magic_arguments, parse_argstring\n\nfrom kedro.framework.cli import load_entry_points\nfrom kedro.framework.cli.project import PARAMS_ARG_HELP\nfrom kedro.framework.cli.utils import ENV_HELP, _split_params\nfrom kedro.framework.project import (\n    LOGGING,  # noqa\n    configure_project,\n    pipelines,\n)\nfrom kedro.framework.session import KedroSession\nfrom kedro.framework.startup import _is_project, bootstrap_project\n\nlogger = logging.getLogger(__name__)\n\n\ndef load_ipython_extension(ipython):\n    \"\"\"\n    Main entry point when %load_ext kedro.ipython is executed, either manually or\n    automatically through `kedro ipython` or `kedro jupyter lab/notebook`.\n    IPython will look for this function specifically.\n    See https://ipython.readthedocs.io/en/stable/config/extensions/index.html\n    \"\"\"\n    ipython.register_magic_function(magic_reload_kedro, magic_name=\"reload_kedro\")\n\n    if _find_kedro_project(Path.cwd()) is None:\n        logger.warning(\n            \"Kedro extension was registered but couldn't find a Kedro project. \"\n            \"Make sure you run '%reload_kedro <project_root>'.\"\n        )\n        return\n\n    reload_kedro()\n\n\n@needs_local_scope\n@magic_arguments()\n@argument(\n    \"path\",\n    type=str,\n    help=(\n        \"Path to the project root directory. If not given, use the previously set\"\n        \"project root.\"\n    ),\n    nargs=\"?\",\n    default=None,\n)\n@argument(\"-e\", \"--env\", type=str, default=None, help=ENV_HELP)\n@argument(\n    \"--params\",\n    type=lambda value: _split_params(None, None, value),\n    default=None,\n    help=PARAMS_ARG_HELP,\n)\ndef magic_reload_kedro(line: str, local_ns: dict[str, Any] = None):\n    \"\"\"\n    The `%reload_kedro` IPython line magic.\n    See https://kedro.readthedocs.io/en/stable/notebooks_and_ipython/kedro_and_notebooks.html#reload-kedro-line-magic # noqa: line-too-long\n    for more.\n    \"\"\"\n    args = parse_argstring(magic_reload_kedro, line)\n    reload_kedro(args.path, args.env, args.params, local_ns)\n\n\ndef reload_kedro(\n    path: str = None,\n    env: str = None,\n    extra_params: dict[str, Any] = None,\n    local_namespace: dict[str, Any] | None = None,\n) -> None:  # pragma: no cover\n    \"\"\"Function that underlies the %reload_kedro Line magic. This should not be imported\n    or run directly but instead invoked through %reload_kedro.\"\"\"\n\n    project_path = _resolve_project_path(path, local_namespace)\n\n    metadata = bootstrap_project(project_path)\n    _remove_cached_modules(metadata.package_name)\n    configure_project(metadata.package_name)\n\n    session = KedroSession.create(\n        metadata.package_name, project_path, env=env, extra_params=extra_params\n    )\n    context = session.load_context()\n    catalog = context.catalog\n\n    get_ipython().push(\n        variables={\n            \"context\": context,\n            \"catalog\": catalog,\n            \"session\": session,\n            \"pipelines\": pipelines,\n        }\n    )\n\n    logger.info(\"Kedro project %s\", str(metadata.project_name))\n    logger.info(\n        \"Defined global variable 'context', 'session', 'catalog' and 'pipelines'\"\n    )\n\n    for line_magic in load_entry_points(\"line_magic\"):\n        register_line_magic(needs_local_scope(line_magic))\n        logger.info(\"Registered line magic '%s'\", line_magic.__name__)  # type: ignore\n\n\ndef _resolve_project_path(\n    path: str | None = None, local_namespace: dict[str, Any] | None = None\n) -> Path:\n    \"\"\"\n    Resolve the project path to use with reload_kedro, updating or adding it\n    (in-place) to the local ipython Namespace (``local_namespace``) if necessary.\n\n    Arguments:\n        path: the path to use as a string object\n        local_namespace: Namespace with local variables of the scope where the line\n            magic is invoked in a dict.\n    \"\"\"\n    if path:\n        project_path = Path(path).expanduser().resolve()\n    else:\n        if local_namespace and \"context\" in local_namespace:\n            # noqa: protected-access\n            project_path = local_namespace[\"context\"]._project_path\n        else:\n            project_path = _find_kedro_project(Path.cwd())\n        if project_path:\n            logger.info(\n                \"Resolved project path as: %s.\\nTo set a different path, run \"\n                \"'%%reload_kedro <project_root>'\",\n                project_path,\n            )\n\n    # noqa: protected-access\n    if (\n        project_path\n        and local_namespace\n        and \"context\" in local_namespace\n        and project_path != local_namespace[\"context\"]._project_path\n    ):\n        logger.info(\"Updating path to Kedro project: %s...\", project_path)\n\n    return project_path\n\n\ndef _remove_cached_modules(package_name):  # pragma: no cover\n    to_remove = [mod for mod in sys.modules if mod.startswith(package_name)]\n    # `del` is used instead of `reload()` because: If the new version of a module does not\n    # define a name that was defined by the old version, the old definition remains.\n    for module in to_remove:\n        del sys.modules[module]\n\n\ndef _find_kedro_project(current_dir: Path):  # pragma: no cover\n    while current_dir != current_dir.parent:\n        if _is_project(current_dir):\n            return current_dir\n        current_dir = current_dir.parent\n\n    return None\n", "path": "kedro/ipython/__init__.py"}], "after_files": [{"content": "\"\"\"\nThis script creates an IPython extension to load Kedro-related variables in\nlocal scope.\n\"\"\"\nfrom __future__ import annotations\n\nimport logging\nimport sys\nfrom pathlib import Path\nfrom typing import Any\n\nfrom IPython import get_ipython\nfrom IPython.core.magic import needs_local_scope, register_line_magic\nfrom IPython.core.magic_arguments import argument, magic_arguments, parse_argstring\n\nfrom kedro.framework.cli import load_entry_points\nfrom kedro.framework.cli.project import CONF_SOURCE_HELP, PARAMS_ARG_HELP\nfrom kedro.framework.cli.utils import ENV_HELP, _split_params\nfrom kedro.framework.project import (\n    LOGGING,  # noqa\n    configure_project,\n    pipelines,\n)\nfrom kedro.framework.session import KedroSession\nfrom kedro.framework.startup import _is_project, bootstrap_project\n\nlogger = logging.getLogger(__name__)\n\n\ndef load_ipython_extension(ipython):\n    \"\"\"\n    Main entry point when %load_ext kedro.ipython is executed, either manually or\n    automatically through `kedro ipython` or `kedro jupyter lab/notebook`.\n    IPython will look for this function specifically.\n    See https://ipython.readthedocs.io/en/stable/config/extensions/index.html\n    \"\"\"\n    ipython.register_magic_function(magic_reload_kedro, magic_name=\"reload_kedro\")\n\n    if _find_kedro_project(Path.cwd()) is None:\n        logger.warning(\n            \"Kedro extension was registered but couldn't find a Kedro project. \"\n            \"Make sure you run '%reload_kedro <project_root>'.\"\n        )\n        return\n\n    reload_kedro()\n\n\n@needs_local_scope\n@magic_arguments()\n@argument(\n    \"path\",\n    type=str,\n    help=(\n        \"Path to the project root directory. If not given, use the previously set\"\n        \"project root.\"\n    ),\n    nargs=\"?\",\n    default=None,\n)\n@argument(\"-e\", \"--env\", type=str, default=None, help=ENV_HELP)\n@argument(\n    \"--params\",\n    type=lambda value: _split_params(None, None, value),\n    default=None,\n    help=PARAMS_ARG_HELP,\n)\n@argument(\"--conf-source\", type=str, default=None, help=CONF_SOURCE_HELP)\ndef magic_reload_kedro(\n    line: str, local_ns: dict[str, Any] = None, conf_source: str = None\n):\n    \"\"\"\n    The `%reload_kedro` IPython line magic.\n    See https://kedro.readthedocs.io/en/stable/notebooks_and_ipython/kedro_and_notebooks.html#reload-kedro-line-magic # noqa: line-too-long\n    for more.\n    \"\"\"\n    args = parse_argstring(magic_reload_kedro, line)\n    reload_kedro(args.path, args.env, args.params, local_ns, args.conf_source)\n\n\ndef reload_kedro(\n    path: str = None,\n    env: str = None,\n    extra_params: dict[str, Any] = None,\n    local_namespace: dict[str, Any] | None = None,\n    conf_source: str = None,\n) -> None:  # pragma: no cover\n    \"\"\"Function that underlies the %reload_kedro Line magic. This should not be imported\n    or run directly but instead invoked through %reload_kedro.\"\"\"\n\n    project_path = _resolve_project_path(path, local_namespace)\n\n    metadata = bootstrap_project(project_path)\n    _remove_cached_modules(metadata.package_name)\n    configure_project(metadata.package_name)\n\n    session = KedroSession.create(\n        metadata.package_name,\n        project_path,\n        env=env,\n        extra_params=extra_params,\n        conf_source=conf_source,\n    )\n    context = session.load_context()\n    catalog = context.catalog\n\n    get_ipython().push(\n        variables={\n            \"context\": context,\n            \"catalog\": catalog,\n            \"session\": session,\n            \"pipelines\": pipelines,\n        }\n    )\n\n    logger.info(\"Kedro project %s\", str(metadata.project_name))\n    logger.info(\n        \"Defined global variable 'context', 'session', 'catalog' and 'pipelines'\"\n    )\n\n    for line_magic in load_entry_points(\"line_magic\"):\n        register_line_magic(needs_local_scope(line_magic))\n        logger.info(\"Registered line magic '%s'\", line_magic.__name__)  # type: ignore\n\n\ndef _resolve_project_path(\n    path: str | None = None, local_namespace: dict[str, Any] | None = None\n) -> Path:\n    \"\"\"\n    Resolve the project path to use with reload_kedro, updating or adding it\n    (in-place) to the local ipython Namespace (``local_namespace``) if necessary.\n\n    Arguments:\n        path: the path to use as a string object\n        local_namespace: Namespace with local variables of the scope where the line\n            magic is invoked in a dict.\n    \"\"\"\n    if path:\n        project_path = Path(path).expanduser().resolve()\n    else:\n        if local_namespace and \"context\" in local_namespace:\n            # noqa: protected-access\n            project_path = local_namespace[\"context\"]._project_path\n        else:\n            project_path = _find_kedro_project(Path.cwd())\n        if project_path:\n            logger.info(\n                \"Resolved project path as: %s.\\nTo set a different path, run \"\n                \"'%%reload_kedro <project_root>'\",\n                project_path,\n            )\n\n    # noqa: protected-access\n    if (\n        project_path\n        and local_namespace\n        and \"context\" in local_namespace\n        and project_path != local_namespace[\"context\"]._project_path\n    ):\n        logger.info(\"Updating path to Kedro project: %s...\", project_path)\n\n    return project_path\n\n\ndef _remove_cached_modules(package_name):  # pragma: no cover\n    to_remove = [mod for mod in sys.modules if mod.startswith(package_name)]\n    # `del` is used instead of `reload()` because: If the new version of a module does not\n    # define a name that was defined by the old version, the old definition remains.\n    for module in to_remove:\n        del sys.modules[module]\n\n\ndef _find_kedro_project(current_dir: Path):  # pragma: no cover\n    while current_dir != current_dir.parent:\n        if _is_project(current_dir):\n            return current_dir\n        current_dir = current_dir.parent\n\n    return None\n", "path": "kedro/ipython/__init__.py"}]}