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

Use botocore vendoring of six #1057

Merged
merged 2 commits into from
Dec 11, 2014
Merged

Use botocore vendoring of six #1057

merged 2 commits into from
Dec 11, 2014

Conversation

kyleknap
Copy link
Contributor

So I switched the CLI off of six to use botocore's version of six.

There is an interesting scenario for our vendored version of six where if you do something like:

from awscli.compat import six
from six.moves import shlex_quote

It will try to pull it from the six installed from dateutil which is a dependency of botocore. So, avoid doing that style of importing modules and functions from the vendored six.

Instead, we need to be explicit in how we import modules from six. Currently, something like this is totally fine:

from awscli.compat import six

if six.PY3:
   #some code

But this is not:

from awscli.compat import six
from six import PY3

if PY3:
   #some code

If you ever want to do it of the style of the second one refer to the compat.py file and add the import there if it is not located there. So, In the new format, if you want to import shlex_quote, you would add it to compat.py and do:

from awscli.compat import shlex_quote

I did my best to try to catch all of them. But, I may have missed some. I expect I missed a few in botocore. So if you run across one please fix it in both botocore and the cli.

cc @jamesls @danielgtaylor

@kyleknap
Copy link
Contributor Author

I forgot:

Fixes #1051

@jamesls
Copy link
Member

jamesls commented Dec 11, 2014

:shipit:

@danielgtaylor
Copy link
Contributor

LGTM 🚢-it. I ran into this in the past as well. This format works too:

from awscli.compat import six

shlex_quote = six.moves.shlex_quote

It's a bit more verbose but can also go up with the imports. Anyway just pulling all these into the compat file seems like a decent approach to me.

kyleknap added a commit that referenced this pull request Dec 11, 2014
Use botocore vendoring of six
@kyleknap kyleknap merged commit cb25f0d into aws:develop Dec 11, 2014
thoward-godaddy pushed a commit to thoward-godaddy/aws-cli that referenced this pull request Feb 12, 2022
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

Successfully merging this pull request may close these issues.

3 participants