Skip to content

Fix: support pathlib.PurePath in normalize_token#9229

Merged
jsignell merged 4 commits intodask:mainfrom
agoose77:patch-1
Jul 6, 2022
Merged

Fix: support pathlib.PurePath in normalize_token#9229
jsignell merged 4 commits intodask:mainfrom
agoose77:patch-1

Conversation

@agoose77
Copy link
Copy Markdown
Contributor

@agoose77 agoose77 commented Jun 30, 2022

dask.base.tokenize does not produce the same string for repeat invocations on the same path. This is because the tokenizer defaults to the object tokenizer.

This PR registers the identity function for the pathlib.PurePath type. I believe this is reasonable, as the default str / repr is a good description of the path. I'm not a Dask expert, though, so there may be reasons that an explicit tokenization is better.

I haven't profiled the startup-time change by importing pathlib, but I assume we're not worrying about that here.

  • 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?

@agoose77 agoose77 marked this pull request as ready for review June 30, 2022 12:58
Comment thread dask/base.py Outdated
@pavithraes
Copy link
Copy Markdown
Member

@agoose77 Thanks for this PR, it looks good! The lining CI failure can be fixed by merging main. :)

@jsignell
Copy link
Copy Markdown
Member

jsignell commented Jul 6, 2022

add to allowlist

@agoose77
Copy link
Copy Markdown
Contributor Author

agoose77 commented Jul 6, 2022

Thanks all. Not sure how that PurePath became Path!

Copy link
Copy Markdown
Member

@jsignell jsignell left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@jsignell jsignell merged commit 3456d42 into dask:main Jul 6, 2022
@jsignell
Copy link
Copy Markdown
Member

jsignell commented Jul 6, 2022

Thanks @agoose77!

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.

4 participants