Skip to content

Commit

Permalink
Make packaged Kedro project work in interactive environment (#4026)
Browse files Browse the repository at this point in the history
* Make packaged kedro work in interactive environment

Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
Signed-off-by: Merel Theisen <49397448+merelcht@users.noreply.github.com>
Co-authored-by: ElenaKhaustova <157851531+ElenaKhaustova@users.noreply.github.com>
  • Loading branch information
merelcht and ElenaKhaustova committed Aug 9, 2024
1 parent 62431bb commit c409d68
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Upcoming Release 0.19.8

## Major features and improvements
* Made default run entrypoint in `__main__.py` work in interactive environments such as IPyhon and Databricks.

## Bug fixes and other changes
* Moved `_find_run_command()` and `_find_run_command_in_plugins()` from `__main__.py` in the project template to the framework itself.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""{{ cookiecutter.project_name }} file for ensuring the package is executable
as `{{ cookiecutter.repo_name }}` and `python -m {{ cookiecutter.python_package }}`
"""

import sys
from pathlib import Path

from kedro.framework.cli.utils import find_run_command
Expand All @@ -10,6 +12,10 @@
def main(*args, **kwargs):
package_name = Path(__file__).parent.name
configure_project(package_name)

interactive = hasattr(sys, 'ps1')
kwargs["standalone_mode"] = not interactive

run = find_run_command(package_name)
run(*args, **kwargs)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""{{ cookiecutter.project_name }} file for ensuring the package is executable
as `{{ cookiecutter.repo_name }}` and `python -m {{ cookiecutter.python_package }}`
"""
import sys
from pathlib import Path

from kedro.framework.cli.utils import find_run_command
Expand All @@ -10,6 +11,10 @@
def main(*args, **kwargs):
package_name = Path(__file__).parent.name
configure_project(package_name)

interactive = hasattr(sys, 'ps1')
kwargs["standalone_mode"] = not interactive

run = find_run_command(package_name)
run(*args, **kwargs)

Expand Down

0 comments on commit c409d68

Please sign in to comment.