The docs for paths.relativize compares itself to os.path.relpath, but the current implementation requires path be fully under start.
In theory it could also work for things that have a common prefix:
paths.relativize("foo/bar/baz", "foo/mumble") could return "../bar/baz"
paths.relativize("foo/bar", "foo/mumble/baz") could return "../../bar"
paths.relativize("foo/bar/baz", "mumble/grumble") could return "../../foo/bar/baz"
Right now these cases fail, so adding the support shouldn't break anyone. If callers want something fully nested, they could check the result to ensure it doesn't start with ...
The docs for
paths.relativize
compares itself toos.path.relpath
, but the current implementation requirespath
be fully understart
.In theory it could also work for things that have a common prefix:
paths.relativize("foo/bar/baz", "foo/mumble")
could return"../bar/baz"
paths.relativize("foo/bar", "foo/mumble/baz")
could return"../../bar"
paths.relativize("foo/bar/baz", "mumble/grumble")
could return"../../foo/bar/baz"
Right now these cases
fail
, so adding the support shouldn't break anyone. If callers want something fully nested, they could check the result to ensure it doesn't start with..
.