Skip to content

Conversation

@kitagry
Copy link
Member

@kitagry kitagry commented Jan 17, 2026

Description

This PR adds generic type support to gokart's custom Parameter classes, following the same approach as Luigi's PR #3369. The base Paramer class and several specialized parameter classes now use Python's Generic type to provide better type hints and IDE support.

Key changes:

  • Made TaskInstanceParameter generic with TaskInstanceParameter[TaskOnKartType]
  • Made ListTaskInstanceParameter generic with ListTaskInstanceParameter[TaskOnKartType]
  • Updated SerializableParameter to inherit from Parameter[S]
  • Updated ZonedDateSecondParameter to inherit from Parameter[datetime.datetime]
  • Added TypeVar for TaskOnKartType to maintain type safety across task instances

Motivation and Context

This change improves the developer experience when using gokart by p
viding:

  • Better type checking in IDEs and type checkers (mypy, pyright, etc
  • Improved autocomplete and IntelliSense support for parameter values
  • More explicit type information for task parameters
  • Better static analysis capabilities for gokart tasks

By leveraging Luigi's generic type support (introduced in spotify/luigi#3369), gokart can now provide even stronger type guarantees for its custom parameter types, particularly TaskInstanceParameter which is heavily used for task dependencies.

This enhancement helps catch type-related bugs earlier in the development process and makes the codebase more maintainable.

@kitagry kitagry requested a review from hiro-o918 as a code owner January 17, 2026 14:57
Copy link
Contributor

@hiro-o918 hiro-o918 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, CI failed

@kitagry kitagry marked this pull request as draft January 24, 2026 04:46
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 this pull request may close these issues.

3 participants