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

Implement UPath.joinuri #189

Merged
merged 4 commits into from
Feb 18, 2024
Merged

Implement UPath.joinuri #189

merged 4 commits into from
Feb 18, 2024

Conversation

ap--
Copy link
Collaborator

@ap-- ap-- commented Feb 18, 2024

Close #88

This seems to be the best compromise regarding urljoin behavior for UPath classes.

UPath.joinpath behaves as close as possible to pathlib.Path

and

UPath.joinuri behaves as urllib.parse.urljoin

@ap-- ap-- self-assigned this Feb 18, 2024
@ap--
Copy link
Collaborator Author

ap-- commented Feb 18, 2024

@joouha this might be interesting for euporie.

I've tried getting the join behavior for HTTPPath to be consistent, but I think this is the best compromise.

If you want urljoin behavior for any UPath, you can use UPath().joinuri(...)
Instead UPath() / "..." or UPath().joinpath(...) will provide pathlib join behavior.

@ap-- ap-- merged commit 1a117b3 into fsspec:main Feb 18, 2024
18 checks passed
@joouha
Copy link
Contributor

joouha commented Feb 18, 2024

Thanks so much for this.

I tried implementing using urljoin behaviour with the / interface a while back, but it felt confusing and wrong when I actually used it, so I think this is a brilliant compromise.

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.

Use urllib.parse.urljoin when joining paths
2 participants