fsspec / universal_pathlib

pathlib api extended to use fsspec backends
MIT License
240 stars 41 forks source link

Implement UPath.joinuri #189

Closed ap-- closed 7 months ago

ap-- commented 7 months ago

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-- commented 7 months ago

@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.

joouha commented 7 months ago

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.