Skip to content

Commit

Permalink
Update starters __main__ to detect interactive session
Browse files Browse the repository at this point in the history
Signed-off-by: Merel Theisen <[email protected]>
  • Loading branch information
merelcht committed Aug 9, 2024
1 parent c6b9e8b commit bcf1b12
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 5 deletions.
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,9 +11,13 @@
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)


if __name__ == "__main__":
main()
main()
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,9 +11,13 @@
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)


if __name__ == "__main__":
main()
main()
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,9 +11,13 @@
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)


if __name__ == "__main__":
main()
main()
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,9 +11,13 @@
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)


if __name__ == "__main__":
main()
main()
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,9 +11,13 @@
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)


if __name__ == "__main__":
main()
main()

0 comments on commit bcf1b12

Please sign in to comment.