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

Fix return type in PanderaTransformer::to_python_value() #2420

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

danieldanciu
Copy link

@danieldanciu danieldanciu commented May 15, 2024

Return an object of the correct type in the to_python_value of the pandera type transformer. Currently, the returned type is pandas.core.frame.DataFrame, but the declared return type is pandera.typing.DataFrame.
I suspect this is because instantiating pandera.DataFrameSchema returns the former rather than what one would normally expect, which is the latter (the pandera DataFrame).

Closes flyteorg/flyte##5369

Why are the changes needed?

Typeguard is unhappy about Flyte workflows that use Pandera, because the type transformer returns an object of the incorrect type.

What changes were proposed in this pull request?

Simply mark the return type as pandera.typing.DataFrame (which inherits from the currently returned type, so I don't expect any major side-effects).

How was this patch tested?

Created a test workflow, checked with typeguard and everything is now running.

Setup process

Not needed.

Check all the applicable boxes

  • I updated the documentation accordingly.
  • All new and existing tests passed. I haven't run any tests, as there aren't any directly related tests AFAICT. I am hoping the Gitlab CI/CD will run them for me.
  • All commits are signed-off.

Copy link

welcome bot commented May 15, 2024

Thank you for opening this pull request! 🙌

These tips will help get your PR across the finish line:

  • Most of the repos have a PR template; if not, fill it out to the best of your knowledge.
  • Sign off your commits (Reference: DCO Guide).

@pingsutw
Copy link
Member

cc @cosmicBboy

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