drivendataorg / drivendataorg/cloudpathlib
Implement shutils equivalent (clutils) that has the same API but accepts AnyPath
- Dominant language
- Python
- Stars
- 628
- Forks
- 88
- Avg merge
- 17h 28m
- Merged PRs (30d)
- 2
Description
Hi, thanks for your awesome library ! Have been searching for a way to use both local and cloud path seamlessy and here it is :D
One particular problem I have with `AnyPath` is that since local paths are redirected to Pathlib, some function are not available, especially `copy` and `copytree`. the reason is that the function to copy are located in the module `shutil` and not associated to the a class method.
As a consequence we can easily copy one cloud folder to another cloud platform, but we cannot easily upload a whole folder from your local filesystem. `path.copy` is not available and `shutil.copy` obviously only works on strings and Path objects.
The two ways I see to solve the problem is either to have a LocalPath class (that basically clones PathLib except for copy methods that are compatible to a cloud destination), or to propose a custom `shutil` module (`from cloudpathlib import AnyPath, shutil`) that would give a standalone `shutil.copytree` function that would be compatible with any path object, local or cloud.
What's your opinion on this ?
PS: for now, I use the `path.upload_from` function, which works but only for files (and is not very similar to `shutil.copy`) and I am in a position where a `copytree` function that would not require me to code a custome function would be nice.
Thanks !
Clément
Contributor guide
Assessment
This issue has not been assessed yet.