-
Notifications
You must be signed in to change notification settings - Fork 28
Conversation
Use stdlib logger in newer versions of pip See pypa/pip#2008 for details
Fixes #65 |
Seeing a lot of these failures in the tests:
@jgmize Did you see these when you ran the tests with your fix? |
try: | ||
from pip.log import logger | ||
except ImportError: | ||
from pip import logger # https://github.com/pypa/pip/pull/2008 |
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.
Do you know offhand which version of pip this is related to? It's probably more useful to comment with the pip version than the pull request url.
@erikrose Opinions on that? ^^^
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'm guessing 6.0, but I haven't verified that yet. Happy to update once I've confirmed.
No, I saw a different error when I ran tox: |
I've replicated the errors locally now (still not with tox, just did a |
Pass now-required session to parse_requirements Add isolated_mode attribute to EmptyOptions class
Looks like the other failures are due to pypa/pip#1796 which made the session kwarg a requirement, but the kwarg was there before. For now, I've added a |
Well, travis is happy now, but after some additional testing I found that pip.download was not available in pip 0.6.2, which appears to be the oldest supported version, so I'll add that logic now. |
I've confirmed that this all started with 6.0 (6.0.3 is latest release as of this writing) and updated and added comments to that effect in the code. |
I really appreciate the work you're putting into this. I'll go through this today. |
try: | ||
from pip.log import logger | ||
except ImportError: | ||
from pip import logger # 6.0 |
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 thought this was a typo, but then discovered they jumped from 1.5.6 to 6.0. Yay versioning!
I tweaked my tox.ini file (I'll submit a PR for that after this lands) and ran tox and everything is fine except Python 3.2 and 3.4 interpreter environments because I don't have 3.2 and 3.4 on my machine. Everything here looks good to me. @erikrose Do you want to eyeball this or is my r+ good enough? |
try: | ||
return [DownloadedReq(req, argv) for req in | ||
parse_requirements(path, options=EmptyOptions())] | ||
except TypeError: |
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 think it would be safer to try the import and catch the ImportError rather than catching TypeError for such a broad piece of code. We could even build a kwargs dict then, avoiding the repeated list comp. Thank you for the fix!
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'm assuming the import succeeds if and only if session
is a required arg. If not, then never mind.)
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.
No, I believe you could import PipSession from pip.download before session
became a required kwarg, I'm just not sure exactly what version of pip parse_requirements began accepting the session
kwarg, so it seemed safer to use the original call that we knew worked up to pip 1.5.6 and only pass in a session if it complains with the TypeError.
I did happen to eyeball it, but in the future, yes, your r+ is plenty good enough! |
I see we don't have Travis running the full Cartesian product of pip and Python versions tox does. We should do something about that sometime. |
In case I was unclear, merge away. Thanks for the patch, @jgmize! |
Use stdlib logger in newer versions of pip
See pypa/pip#2008 for details