-
-
Notifications
You must be signed in to change notification settings - Fork 382
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
Refactor S3, replace high-level resource/session API with low-level client API #583
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work @mpenkov 🔥
Just one note
@piskvorky Can you please have a look at this? I'd like to merge and release so I can use this in one of my projects. |
@piskvorky Ping |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did a cursory review, the code seems good. But what about compatibility? What does this do to existing users?
Co-authored-by: Radim Řehůřek <[email protected]>
This is a breaking change. People doing stuff with kwargs will have to switch from using resource paramaters to using client ones. This will mean a major version bump. |
OK. And is this documented somewhere? A migration guide? |
Good point. I added a section to the migration guide. Please have a look. |
Co-authored-by: Radim Řehůřek <[email protected]>
Updated https://github.com/RaRe-Technologies/smart_open/blob/client/MIGRATING_FROM_OLDER_VERSIONS.rst, please have a look. |
While functionally they are the same, the session/resource stuff is not safe to use across multiple threads and subprocesses, and the client stuff is. The former is a bit easier to use directly than the latter, but this does not impact the user, because smart_open is doing all the work.
I also refactored the way we pass keyword parameters to boto3. Previously, we had a separate parameter for each boto3 function. This was a pain, because this made parameter lists longer for each new function, e.g.
This PR moves all of the above parameters into a single nested dict and introduces a wrapper that transparently injects the parameters into the required function call.
This does break backwards compatibility, so will need a major version bump when releasing.