pfio.v2.Path shall be independent from pfio.v2.FS implementations such as S3 and so on as it includes too much information to represent generic paths and its manipulations. In this PR, it deprecates giving pfio.v2.FS to the constructor of pfio.v2.Path, and add a new method .scope() to FS for calling file access methods from Path such as open and exists.
Before:
with from_url('s3://bucket/path/to/dir') as s3:
p = Path('path/to/file', fs=s3)
p.open().read()
After this PR, we can do this:
p = Path('path/to/file')
with from_url('s3://bucket/path/to/dir') as s3:
with s3.scope():
p.open().read()
Current style (above) remains supported for 2.7.x, but will be removed in 2.8.
pfio.v2.Path
shall be independent frompfio.v2.FS
implementations such as S3 and so on as it includes too much information to represent generic paths and its manipulations. In this PR, it deprecates givingpfio.v2.FS
to the constructor ofpfio.v2.Path
, and add a new method.scope()
toFS
for calling file access methods from Path such asopen
andexists
.Before:
After this PR, we can do this:
Current style (above) remains supported for 2.7.x, but will be removed in 2.8.