fsspec / universal_pathlib

pathlib api extended to use fsspec backends
MIT License
240 stars 42 forks source link

Problem with opening local file with "compression=..." #171

Closed seandavi closed 7 months ago

seandavi commented 8 months ago

See behavior difference with "file://filename" uri vs "filename" uri with compression.

>>> print(upath.__version__)
0.1.4
>>> a = UPath('abc.json.gz')
>>> a.open('wb', compression='gzip')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: open() got an unexpected keyword argument 'compression'
>>> 
>>> a = UPath('file:///tmp/abc.json.gz')
>>> a.open('wb', compression='gzip')
<gzip fsspec.implementations.local.LocalFileOpener object at 0x1028548b0 0x1034b1f40>
ap-- commented 8 months ago

Thank you for reporting @seandavi ❤️

We should align the method signatures and raise a warning for stdlib pathlib in this case.

Would you be willing to work on a PR?

Cheers, Andreas