Skip to content

Add type annotations to dd.from_pandas and dd.from_delayed#9237

Merged
ian-r-rose merged 16 commits intodask:mainfrom
multimeric:from_delayed
Jul 21, 2022
Merged

Add type annotations to dd.from_pandas and dd.from_delayed#9237
ian-r-rose merged 16 commits intodask:mainfrom
multimeric:from_delayed

Conversation

@multimeric
Copy link
Copy Markdown
Contributor

I noticed that this method actually accepts a single Delayed so I've tried to codify that in the docstring + type signature. And I improved the type signatures a little while I was there. I couldn't fix the meta type annotation because of reasons discussed in #9233.

  • Closes #xxxx
  • Tests added / passed
  • Passes pre-commit run --all-files

@GPUtester
Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@pavithraes
Copy link
Copy Markdown
Member

We'll also need to include from __future__ import annotations at the very top of the file, which is necessary for the | syntax, and to fix all the tests failing with NameError: name 'distributed' is not defined.

@pavithraes
Copy link
Copy Markdown
Member

@multimeric Thank you for opening this PR!

@multimeric multimeric mentioned this pull request Jul 9, 2022
3 tasks
@multimeric
Copy link
Copy Markdown
Contributor Author

I wonder if there are any suggestions about how I can type check a distributed.Future at runtime without actually forcing a dependency on that package? Currently I check the class name which is a bit ugly.

multimeric and others added 3 commits July 15, 2022 03:41
Co-authored-by: Ian Rose <ian.r.rose@gmail.com>
Co-authored-by: Pavithra Eswaramoorthy <pavithraes@outlook.com>
@multimeric
Copy link
Copy Markdown
Contributor Author

I've also removed the redundant type annotations as per this discussion.

@multimeric
Copy link
Copy Markdown
Contributor Author

All good to merge?

@pavithraes
Copy link
Copy Markdown
Member

@multimeric This looks great, thank you!

@pavithraes pavithraes requested a review from jrbourbeau July 18, 2022 13:05
@pavithraes
Copy link
Copy Markdown
Member

@multimeric Thank you for working on this!

@pavithraes pavithraes changed the title Allow a single Delayed instance to DataFrame.from_delayed Add type annotations to dd.from_pandas and dd.from_delayed Jul 21, 2022
Copy link
Copy Markdown
Collaborator

@ian-r-rose ian-r-rose left a comment

Choose a reason for hiding this comment

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

Thanks @multimeric!

@ian-r-rose ian-r-rose merged commit 84533ea into dask:main Jul 21, 2022
jyap-abc added a commit to jjyap/dask that referenced this pull request Aug 8, 2022
jjyap added a commit to jjyap/dask that referenced this pull request Aug 8, 2022
jyap-abc pushed a commit to jjyap/dask that referenced this pull request Aug 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants