Skip to content

[feature] Fix typing of component-decorator to avoid errors in strict LSPs #12354

@HackNSnack

Description

@HackNSnack

Feature Area

/area sdk

/area components

What feature would you like to see?

I'd like to see the kfp SDK improved with better typing for the @dsl.component decorator, as it seems to give both inconsistent and incorrect types.

What is the use case or pain point?

Pointing to the discussion I brought up, it seems like the decorator provides incorrect types. If using a stricter LSP such as Pyright (e.g. more strict than VSCode default of Pylance), this leads to many errors during development, as well as failure of autocomplete suggestions.

I'll give one example, where the use of parentheses (or lack thereof) changes the type of the decorated function;

Image Image

I am slower at developing due to lack of autocomplete & "Go to Definition" behaviour, making it harder to read the source code and understand what objects are actually being used where.

Is there a workaround currently?

I completely disable all type-checking for KFP specifically. I also mainly copy-paste exact examples from docs, as my IDE cannot help much with customisation due to lack of proper typing.


Love this idea? Give it a 👍.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions