Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kedro pipeline create pipeline.py with missing import #3557

Closed
noklam opened this issue Jan 25, 2024 · 5 comments · Fixed by #4395
Closed

kedro pipeline create pipeline.py with missing import #3557

noklam opened this issue Jan 25, 2024 · 5 comments · Fixed by #4395
Assignees

Comments

@noklam
Copy link
Contributor

noklam commented Jan 25, 2024

Description

A user was facing this problem:

Brandon Meek
1 hour ago
Hey everyone, can someone help me understand why node was removed from the boilerplate imports in pipeline.py? It seems like it's necessary? (edited)

Brandon Meek
26 minutes ago
Sorry, I meant from the boilerplate created after running kedro pipeline create ...

Context

"""
This is a boilerplate pipeline 'nok'
generated using Kedro 0.19.2
"""

from kedro.pipeline import Pipeline, pipeline

The current CLI created this file, it used to import node also but was removed when we introduced ruff.

The problem is because node is not used so the linter pick it up. We should either have a #noqa or have linter skip the template file.

Expected Result

Expectation is that kedro pipeline create creates a runnable pipeline with the correct imports.

Actual Result

The node import is missing.

Your Environment

  • Kedro version used (pip show kedro or kedro -V):
  • Python version used (python -V):
  • Operating system and version:
@astrojuanlu
Copy link
Member

+1000 this is a very common annoyance.

Aside from # noqa, another idea is to supplement a dummy pipeline? For example

def create_pipeline(**kwargs) -> Pipeline:
    return pipeline([
        node(
            func=...,
            inputs=...,
            outputs=...,
        )
    ])

@noklam
Copy link
Contributor Author

noklam commented Jan 29, 2024

@astrojuanlu It sounds good to me at first, but then I think it may causes issues because of pipeline autodiscovery. As soon as someone do kedro pipeline create, their __default__ pipeline will get a random dummy node.

@astrojuanlu
Copy link
Member

For context, this comes from

"""
This is a boilerplate pipeline '{{ cookiecutter.pipeline_name }}'
generated using Kedro {{ cookiecutter.kedro_version }}
"""
from kedro.pipeline import Pipeline, pipeline

Let's do a quick exploration of how the UX is like in the case of a dummy node, if it's too bad or confusing let's settle on # noqa, but @deepyaman pointed out that this will remain in users code.

@astrojuanlu
Copy link
Member

Another option, is to have

 from kedro.pipeline import Pipeline, pipeline  # , node

@astrojuanlu
Copy link
Member

Another user complained about this today

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants