Skip to content

relative_to on GCSPaths does not return a relative path #170

Open
@xjmdale

Description

@xjmdale

Observed behavior:

>>> p1 = upath.UPath("gs://bucket/foo/bar")
>>> p2 = upath.UPath("gs://bucket/foo/bar/baz/quux.txt")
>>> p2.relative_to(p1)
GCSPath('gs://bucket/baz/quux.txt')

The result is not a relative path; it is an absolute path to an alternative GCS object which may or may not exist.

My expectation is that this call would return a fully-relative path to baz/quux.txt. I suppose there is uncertainty is around which path subtype should be returned. baz/quux.txt is not a valid GCS path; but upath.UPath('baz/quux.txt') returns a PosixUPath which also seems wrong.

Python version: 3.11.7
upath version: 0.1.4

Metadata

Metadata

Assignees

Labels

bug 🐛Something isn't workingdocumentation 📘Improvements or additions to documentation

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions