Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question/discussion] Why S3Path's smart_open usage defaults to compression='disable'? #93

Open
Kache opened this issue Oct 5, 2021 · 3 comments

Comments

@Kache
Copy link

Kache commented Oct 5, 2021

Seeing as how S3Path leverages smart_open, I was surprised that:

S3Path('/mybucket/mypath/file.csv.gz').open()

Did not "autodetect" compression from file extension, as smart_open does by default:

smart_open.open(S3Path('/mybucket/mypath/file.csv.gz'))

As it turns out, S3Path sets compression='disable': https://github.com/liormizr/s3path/blob/master/s3path.py#L388

Any particular reason?

@liormizr
Copy link
Owner

Hi @Kache, thank you for opening the discussion.
The all idea of S3Path is not to touch / add unexpected behaviour for the pathlib standard api.
A developer that know pathlib should know all he need to know to use s3 with s3path.

Now, in the past year we did added a custom features that relates to our specific implementations and we did add some features that specific for s3.
If you (or any body else) have a new api suggestion that won't interfere with that approach, I'm open to discussion it :-)

@Kache
Copy link
Author

Kache commented Oct 14, 2021

Ah, that makes sense. Thanks.

With that understanding, then my suggestion is to expose:

S3Path('/mybucket/mypath/file.csv.gz').smart_open()

# equivalent to
import smart_open

smart_open.open(S3Path('/mybucket/mypath/file.csv.gz'))

Could have the method passthrough arguments to smart_open as well.

I don't feel too strongly about it though, up to you. (Close issue if you'd like)
I'll be calling smart_open myself in the meantime.

@liormizr
Copy link
Owner

Hi @Kache sounds good

It will take me sometime to work on it.
If you want this feature fast, you are more then welcome to contribute and create a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants