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

upload_file() and download_file() for Bucket and Object #243

Merged

Conversation

rayluo
Copy link
Contributor

@rayluo rayluo commented Sep 4, 2015

Unit test, function test, integration test and CHANGELOG are also updated.

@rayluo rayluo added enhancement This issue requests an improvement to a current feature. pr/needs-review This PR needs a review from a member of the team. labels Sep 8, 2015
def bucket_download_file(self, Key, Filename,
ExtraArgs=None, Callback=None, Config=None):
"""Download an S3 object to a file."""
transfer = S3Transfer(self.meta.client, Config)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason we can't just use the .meta.client methods for upload_file/download_file? Also seems like it would cut down on the duplicate boiler plate of creating an S3Transfer object for each of the four functions you've added.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems the S3Transfer provides more advanced features. Besides, the pre-existing upload_file() and download_file() also use S3Transfer so I follow the pattern.

Understood. You are talking about the already-injected self.meta.client, not the raw botocore client. Testing. Will send out new PR soon.

@rayluo rayluo force-pushed the feature-s3-transfer-methods-for-bucket-and-object branch from a87a6e9 to e83f72f Compare September 11, 2015 23:21
@jamesls
Copy link
Member

jamesls commented Sep 18, 2015

:shipit: Looks good!


def bucket_upload_file(self, Filename, Key,
ExtraArgs=None, Callback=None, Config=None):
"""Upload a file to an S3 object."""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be cool if we can add a little more to all of these docstrings. These docstrings will get publicly exposed in our documentation and it would be nice to have parameters documented and maybe even an example of how to use it.

@kyleknap
Copy link
Contributor

It looks good to me. Had a little nit picky comment about the docstrings. I felt that it would be good to build up to help the exposure of these methods as they will show up in the html along with its docstrings in the list of available actions for the Bucket and Key. Otherwise, 🚢

@rayluo rayluo force-pushed the feature-s3-transfer-methods-for-bucket-and-object branch from e83f72f to d648c9d Compare September 19, 2015 20:10
Detailed explanations and examples can be found at S3Transfer's Usage page
http://boto3.readthedocs.org/en/latest/reference/customizations/s3.html#usage
"""
for family, funcions in functions_to_be_patched.items():
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should generally avoid having code like this run in the global scope.

There's already very similar text in each of the docstrings. I don't think it's that big of a downside if we have to repeat some documentation.

If we really want to save some copy/paste of docs, we should be doing it in a way that avoids code at the module level.

However, I'd vote to just keep it simple and add the docstrings directly.

@rayluo rayluo force-pushed the feature-s3-transfer-methods-for-bucket-and-object branch from d648c9d to e0117f6 Compare September 21, 2015 23:46
@rayluo
Copy link
Contributor Author

rayluo commented Sep 21, 2015

The latest feedback has been incorporated. That CI error is caused by another issue not relevant to this PR.

@jamesls
Copy link
Member

jamesls commented Sep 21, 2015

What is the issue related to the CI error?

@rayluo
Copy link
Contributor Author

rayluo commented Sep 22, 2015

It is relevant to this PR in botocore. boto/botocore#645

@jamesls
Copy link
Member

jamesls commented Sep 23, 2015

We generally don't merge things unless the travis builds pass. Wouldn't rebasing against develop get the builds passing?

Once you're able to get travis passing feel free to merge.

@kyleknap
Copy link
Contributor

@jamesls
Rebasing will not help. The tests in boto3 need to get updated because it relies on output for documentation that was changed in botocore. I address it in this PR: #239. But in the meantime, we should get a PR in soon that updates the test if it is going to take a while to review the resource docstring PR. The updates are minor. I think @rayluo is working on one.

@rayluo
Copy link
Contributor Author

rayluo commented Sep 23, 2015

OK we are making progress have removed the roadblock in pr #271

Rely on the already-injected meta.client rather then S3Transfer.
Unit test, function test, integration test and CHANGELOG are also updated.
@rayluo rayluo force-pushed the feature-s3-transfer-methods-for-bucket-and-object branch from e0117f6 to a59b6a0 Compare September 24, 2015 00:41
@kyleknap
Copy link
Contributor

Looks good to merge. I would not worry about the coveralls check not running.

@jamesls
Copy link
Member

jamesls commented Sep 24, 2015

:shipit:

rayluo added a commit that referenced this pull request Sep 24, 2015
…ucket-and-object

upload_file() and download_file() for Bucket and Object
@rayluo rayluo merged commit 4a7419a into boto:develop Sep 24, 2015
@rayluo rayluo deleted the feature-s3-transfer-methods-for-bucket-and-object branch September 24, 2015 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This issue requests an improvement to a current feature. pr/needs-review This PR needs a review from a member of the team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants