Closed mukund109 closed 7 months ago
Thank you, Mukundh! :D
I think it's correct that create_path is removed, but I'd type this with UPath instead of with Path.
Let's see what @Koncopd says.
Oh I figured this method is meant to apply to pathlib.Path
and its sub-classes:
https://github.com/laminlabs/lamindb-setup/blob/main/lamindb_setup/dev/upath.py#L367
Ye, if it is only used as a method of UPath
or Path
, it should be fine.
@falexwolf do we use it on its own anywhere, not like ln.UPath(path_str).view_tree()
, but view_tree(path_str)
? I don't see it.
Yeah! And also to UPath:
Isn't UPath
a subclass of Path
? Making path: Path
equivalent to path: Union[Path, UPath]
I can see in other parts of the code-base also that you've explicitly typed Union[Path, UPath]
. Couldn't quite figure out the reason for this.
No, we don't! It's only used via path.view_tree(), so, we need no conversion from str and don't need to call create_path.
I think this is reminiscent of the old implementation.
Isn't UPath a subclass of Path? Making path: Path equivalent to path: Union[Path, UPath]
If this is the case, now, then it's all good! Previously, coming from CloudPath, we always proxied a cloud path via UPath and a local path via Path. But since upath 0.1 with the proper type system, I think we might not need this anymore.
Let's merge this PR as it is now!
Merging this, now! In case it breaks tests, I'll fix it.
Thanks a ton for this, Mukundh!
view_tree
is only being used as a method for thePath
(andUPath
) classes. There aren't any places where its being called with astr
argument.I've modified it to not accept
str
arguments anymore and removed the call tocreate_path
.This fixes https://github.com/laminlabs/lamindb/issues/1407