prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Add parameters to `%reload_kedro` line magic 
  ## Description
  
  Currently you cannot pass things like `env` or `extra_params` via the line magic, but you can by importing the function.
  
  https://github.com/kedro-org/kedro/blob/5ae97cfb70e5b0d4490132847977d482f13c840f/kedro/extras/extensions/ipython.py#L38
  
  Why don't we introduce feature parity here? 
  
  </issue>
  <code>
  [start of kedro/extras/extensions/ipython.py]
  1 # pylint: disable=import-outside-toplevel,global-statement,invalid-name,too-many-locals
  2 """
  3 This script creates an IPython extension to load Kedro-related variables in
  4 local scope.
  5 """
  6 import logging
  7 import sys
  8 from pathlib import Path
  9 from typing import Any, Dict
  10 
  11 logger = logging.getLogger(__name__)
  12 default_project_path = Path.cwd()
  13 
  14 
  15 def _remove_cached_modules(package_name):
  16     to_remove = [mod for mod in sys.modules if mod.startswith(package_name)]
  17     # `del` is used instead of `reload()` because: If the new version of a module does not
  18     # define a name that was defined by the old version, the old definition remains.
  19     for module in to_remove:
  20         del sys.modules[module]  # pragma: no cover
  21 
  22 
  23 def _find_kedro_project(current_dir: Path):  # pragma: no cover
  24     from kedro.framework.startup import _is_project
  25 
  26     while current_dir != current_dir.parent:
  27         if _is_project(current_dir):
  28             return current_dir
  29         current_dir = current_dir.parent
  30 
  31     return None
  32 
  33 
  34 def reload_kedro(
  35     path: str = None, env: str = None, extra_params: Dict[str, Any] = None
  36 ):
  37     """Line magic which reloads all Kedro default variables.
  38     Setting the path will also make it default for subsequent calls.
  39     """
  40     from IPython import get_ipython
  41     from IPython.core.magic import needs_local_scope, register_line_magic
  42 
  43     from kedro.framework.cli import load_entry_points
  44     from kedro.framework.project import LOGGING  # noqa # pylint:disable=unused-import
  45     from kedro.framework.project import configure_project, pipelines
  46     from kedro.framework.session import KedroSession
  47     from kedro.framework.startup import bootstrap_project
  48 
  49     # If a path is provided, set it as default for subsequent calls
  50     global default_project_path
  51     if path:
  52         default_project_path = Path(path).expanduser().resolve()
  53         logger.info("Updated path to Kedro project: %s", default_project_path)
  54     else:
  55         logger.info("No path argument was provided. Using: %s", default_project_path)
  56 
  57     metadata = bootstrap_project(default_project_path)
  58     _remove_cached_modules(metadata.package_name)
  59     configure_project(metadata.package_name)
  60 
  61     session = KedroSession.create(
  62         metadata.package_name, default_project_path, env=env, extra_params=extra_params
  63     )
  64     context = session.load_context()
  65     catalog = context.catalog
  66 
  67     get_ipython().push(
  68         variables={
  69             "context": context,
  70             "catalog": catalog,
  71             "session": session,
  72             "pipelines": pipelines,
  73         }
  74     )
  75 
  76     logger.info("Kedro project %s", str(metadata.project_name))
  77     logger.info(
  78         "Defined global variable 'context', 'session', 'catalog' and 'pipelines'"
  79     )
  80 
  81     for line_magic in load_entry_points("line_magic"):
  82         register_line_magic(needs_local_scope(line_magic))
  83         logger.info("Registered line magic '%s'", line_magic.__name__)  # type: ignore
  84 
  85 
  86 def load_ipython_extension(ipython):
  87     """Main entry point when %load_ext is executed"""
  88 
  89     global default_project_path
  90 
  91     ipython.register_magic_function(reload_kedro, "line", "reload_kedro")
  92 
  93     default_project_path = _find_kedro_project(Path.cwd())
  94 
  95     if default_project_path is None:
  96         logger.warning(
  97             "Kedro extension was registered but couldn't find a Kedro project. "
  98             "Make sure you run '%reload_kedro <project_root>'."
  99         )
  100         return
  101 
  102     reload_kedro(default_project_path)
  103
  [end of kedro/extras/extensions/ipython.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/kedro/extras/extensions/ipython.py b/kedro/extras/extensions/ipython.py
  --- a/kedro/extras/extensions/ipython.py
  +++ b/kedro/extras/extensions/ipython.py
  @@ -8,6 +8,9 @@
   from pathlib import Path
   from typing import Any, Dict
   
  +from kedro.framework.cli.project import PARAMS_ARG_HELP
  +from kedro.framework.cli.utils import ENV_HELP, _split_params
  +
   logger = logging.getLogger(__name__)
   default_project_path = Path.cwd()
   
  @@ -84,12 +87,46 @@
   
   
   def load_ipython_extension(ipython):
  -    """Main entry point when %load_ext is executed"""
  +    """
  +    Main entry point when %load_ext is executed.
  +    IPython will look for this function specifically.
  +    See https://ipython.readthedocs.io/en/stable/config/extensions/index.html
   
  -    global default_project_path
  +    This function is called when users do `%load_ext kedro.extras.extensions.ipython`.
  +    When user use `kedro jupyter notebook` or `jupyter ipython`, this extension is
  +    loaded automatically.
  +    """
  +    from IPython.core.magic_arguments import argument, magic_arguments, parse_argstring
  +
  +    @magic_arguments()
  +    @argument(
  +        "path",
  +        type=str,
  +        help=(
  +            "Path to the project root directory. If not given, use the previously set"
  +            "project root."
  +        ),
  +        nargs="?",
  +        default=None,
  +    )
  +    @argument("-e", "--env", type=str, default=None, help=ENV_HELP)
  +    @argument(
  +        "--params",
  +        type=lambda value: _split_params(None, None, value),
  +        default=None,
  +        help=PARAMS_ARG_HELP,
  +    )
  +    def magic_reload_kedro(line: str):
  +        """
  +        The `%reload_kedro` IPython line magic. See
  +         https://kedro.readthedocs.io/en/stable/tools_integration/ipython.html for more.
  +        """
  +        args = parse_argstring(magic_reload_kedro, line)
  +        reload_kedro(args.path, args.env, args.params)
   
  -    ipython.register_magic_function(reload_kedro, "line", "reload_kedro")
  +    global default_project_path
   
  +    ipython.register_magic_function(magic_reload_kedro, magic_name="reload_kedro")
       default_project_path = _find_kedro_project(Path.cwd())
   
       if default_project_path is None:
  
verification_info: {"golden_diff": "diff --git a/kedro/extras/extensions/ipython.py b/kedro/extras/extensions/ipython.py\n--- a/kedro/extras/extensions/ipython.py\n+++ b/kedro/extras/extensions/ipython.py\n@@ -8,6 +8,9 @@\n from pathlib import Path\n from typing import Any, Dict\n \n+from kedro.framework.cli.project import PARAMS_ARG_HELP\n+from kedro.framework.cli.utils import ENV_HELP, _split_params\n+\n logger = logging.getLogger(__name__)\n default_project_path = Path.cwd()\n \n@@ -84,12 +87,46 @@\n \n \n def load_ipython_extension(ipython):\n-    \"\"\"Main entry point when %load_ext is executed\"\"\"\n+    \"\"\"\n+    Main entry point when %load_ext is executed.\n+    IPython will look for this function specifically.\n+    See https://ipython.readthedocs.io/en/stable/config/extensions/index.html\n \n-    global default_project_path\n+    This function is called when users do `%load_ext kedro.extras.extensions.ipython`.\n+    When user use `kedro jupyter notebook` or `jupyter ipython`, this extension is\n+    loaded automatically.\n+    \"\"\"\n+    from IPython.core.magic_arguments import argument, magic_arguments, parse_argstring\n+\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+    def magic_reload_kedro(line: str):\n+        \"\"\"\n+        The `%reload_kedro` IPython line magic. See\n+         https://kedro.readthedocs.io/en/stable/tools_integration/ipython.html for more.\n+        \"\"\"\n+        args = parse_argstring(magic_reload_kedro, line)\n+        reload_kedro(args.path, args.env, args.params)\n \n-    ipython.register_magic_function(reload_kedro, \"line\", \"reload_kedro\")\n+    global default_project_path\n \n+    ipython.register_magic_function(magic_reload_kedro, magic_name=\"reload_kedro\")\n     default_project_path = _find_kedro_project(Path.cwd())\n \n     if default_project_path is None:\n", "issue": "Add parameters to `%reload_kedro` line magic \n## Description\r\n\r\nCurrently you cannot pass things like `env` or `extra_params` via the line magic, but you can by importing the function.\r\n\r\nhttps://github.com/kedro-org/kedro/blob/5ae97cfb70e5b0d4490132847977d482f13c840f/kedro/extras/extensions/ipython.py#L38\r\n\r\nWhy don't we introduce feature parity here? \n", "before_files": [{"content": "# pylint: disable=import-outside-toplevel,global-statement,invalid-name,too-many-locals\n\"\"\"\nThis script creates an IPython extension to load Kedro-related variables in\nlocal scope.\n\"\"\"\nimport logging\nimport sys\nfrom pathlib import Path\nfrom typing import Any, Dict\n\nlogger = logging.getLogger(__name__)\ndefault_project_path = Path.cwd()\n\n\ndef _remove_cached_modules(package_name):\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]  # pragma: no cover\n\n\ndef _find_kedro_project(current_dir: Path):  # pragma: no cover\n    from kedro.framework.startup import _is_project\n\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\n\ndef reload_kedro(\n    path: str = None, env: str = None, extra_params: Dict[str, Any] = None\n):\n    \"\"\"Line magic which reloads all Kedro default variables.\n    Setting the path will also make it default for subsequent calls.\n    \"\"\"\n    from IPython import get_ipython\n    from IPython.core.magic import needs_local_scope, register_line_magic\n\n    from kedro.framework.cli import load_entry_points\n    from kedro.framework.project import LOGGING  # noqa # pylint:disable=unused-import\n    from kedro.framework.project import configure_project, pipelines\n    from kedro.framework.session import KedroSession\n    from kedro.framework.startup import bootstrap_project\n\n    # If a path is provided, set it as default for subsequent calls\n    global default_project_path\n    if path:\n        default_project_path = Path(path).expanduser().resolve()\n        logger.info(\"Updated path to Kedro project: %s\", default_project_path)\n    else:\n        logger.info(\"No path argument was provided. Using: %s\", default_project_path)\n\n    metadata = bootstrap_project(default_project_path)\n    _remove_cached_modules(metadata.package_name)\n    configure_project(metadata.package_name)\n\n    session = KedroSession.create(\n        metadata.package_name, default_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 load_ipython_extension(ipython):\n    \"\"\"Main entry point when %load_ext is executed\"\"\"\n\n    global default_project_path\n\n    ipython.register_magic_function(reload_kedro, \"line\", \"reload_kedro\")\n\n    default_project_path = _find_kedro_project(Path.cwd())\n\n    if default_project_path 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(default_project_path)\n", "path": "kedro/extras/extensions/ipython.py"}]}