-
-
Notifications
You must be signed in to change notification settings - Fork 380
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
Migrate to boto3
. Fix #43
#164
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.
Looks good
conn = boto.connect_s3() | ||
conn.create_bucket("mybucket") | ||
s3 = boto3.resource('s3') | ||
s3.create_bucket(Bucket='mybucket') |
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.
Maybe, better to use "global" bucket /key (as in https://github.com/RaRe-Technologies/smart_open/blob/master/smart_open/tests/test_s3.py#L16) + same maybe_mock_s3
?
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.
Done
smart_open/tests/test_smart_open.py
Outdated
@@ -968,6 +975,9 @@ class S3OpenTest(unittest.TestCase): | |||
@mock_s3 | |||
def test_r(self): | |||
"""Reading a UTF string should work.""" | |||
# |
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.
What's your plan to do with this type of test (with FIXME
)?
@piskvorky @menshikh-iv Moving all tests across to boto3 requires moving some of our core functionality from boto to boto3. This affects two features:
I can see three ways going forward. In my opinion, in order of decreasing subjective goodness:
I think 1) is a bit extreme, because it will surprise (anger) some people. 3) is poor, because it makes us do additional work to support a deprecated library, but marginally better than 4). I think 2) is a good compromise, because it isn't difficult to switch between boto and boto3 in application code. What do you guys think? |
Thanks for detailed description @mpenkov, I'm +1 for (2) because we want to migrate to boto3 a long time ago, see #43, I see no reasons to support boto2 anymore (more than that, this project doesn't develop actively now https://github.com/boto/boto (they send us to boto3)). |
I agree with @menshikh-iv . |
.travis.yml
Outdated
@@ -30,6 +30,8 @@ matrix: | |||
|
|||
install: | |||
- pip install .[test] | |||
- pip uninstall --yes botocore boto3 |
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.
better to edit setup.py
as we discussed, I think this will work
_MULTIPROCESSING = False | ||
try: | ||
import multiprocessing.pool | ||
_MULTIPROCESSING = True |
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.
why can multiprocessing
be unavailable?
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 trust the above comment. It may be unavailable in certain environments, but I've never been in one.
@@ -672,168 +615,6 @@ def write_callback(request): | |||
assert responses.calls[3].request.url == "http://127.0.0.1:8440/file" | |||
|
|||
|
|||
class S3IterBucketTest(unittest.TestCase): |
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.
These tests have no more sense, am I right?
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.
Yes. Most of them moved to the s3 module. The others have lost their meaning with the rewrite.
@mpenkov what's missed here (especially what's about cases when this is impossible to replace old boto)? Is current PR ready to merge? |
@menshikh-iv Yes, I think it's ready. |
boto3
. Fix #43
Great work @mpenkov 🔥 |
Creating a new pull request to get around travis' secure data issues.