-
Notifications
You must be signed in to change notification settings - Fork 193
Conversation
It appears that although the tests all passed, Travis didn't like the missing code coverage. However, I'm not sure how to achieve 100% coverage, since (minimal) pieces of logic are gated on whether the current Python is 2 or 3. How are problems like this normally handled? |
@alekstorm Thanks so much for this: I didn't actually expect you to do the work yourself! I haven't looked at the code yet so expect some review comments, but I'll answer your top level questions/comments now. Firstly, I'm not that attached to the keyword-only argument stuff for Python 3. I liked it because it cleaned the API up, but not so much that it's worth bending over backward to keep. I'm happy to support 2.7 without NPN for the moment, but I consider it to be a sad state of affairs. In particular, I suspect it hurts our interop prospects: given that HTTP/2 is usually served over the same port as HTTP/HTTPS, I suspect that without NPN/ALPN most servers won't actually talk to us. This means that we really need #28 to get a positive Python 2 story here. Given the existence of this pull request, I'm going to upgrade #28 from "Wouldn't It be Nice If" to "Long-term Goal". I'm glad you didn't use 2to3, because I'd probably have rejected the pull request if you did! =D Yes, I mandate 100% code coverage in this project, so we're going to need to fix that. I won't be able to give concrete advice about how to improve the coverage until I've reviewed the code, so I'll get back to you on it. Finally, I'm glad the test suite was helpful! I certainly spent enough time on it. =P Once again, thanks for this, it's a huge help! 🍰 |
if IS_PY3: | ||
from urllib.parse import urlparse | ||
else: | ||
from urlparse import urlparse |
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.
For things like this we should steal the requests approach, which is to have a file called compat
that pastes over the differences. That way we can avoid having this horrible conditional import logic at the top of all our files.
Alright, code review inline. One of these notes requires you to restructure the project which should hopefully make it much easier for us to fixup the code coverage problems, so I'll hold off on advice there until you've acted on the review comments. As always, if you disagree with a review comment let me know. =) Otherwise, let me know when you're done and I'll take another look. |
Also, don't forget to add yourself to AUTHORS.rst! |
I'm glad you're open to supporting Py2.7 for now, even without NPN/ALPN support. I agree it's far from ideal; I hope to rectify the situation in an upcoming PR. |
Er, I'm flattered, but there is no |
Heh, I apologise, I meant |
Aaand I missed that, somehow. Thanks. On Wed, Apr 2, 2014 at 2:28 PM, Cory Benfield notifications@git.luolix.topwrote:
|
Okay, done. Most compatibility logic was moved into the new |
Just finished a compatibility layer that exposes pyOpenSSL as an API equivalent to the standard Python 3.x |
This looks great, I don't see any further changes required here. I don't understand why Travis reported such bad code coverage, so I'll have to dig into that myself. As for a compatibility layer, it presumably requires a version of PyOpenSSL newer than the current release, considering that NPN support isn't in the current one? If that's the case, it'd be better as a new Pull Request. =) |
Sure, that's no problem (although it's worth noting that the compatibility layer is only used on Py2.7). |
We should avoid the compatibility layer being used on only one platform: we should use it consistently. Fewer bugs. =) |
Hm, I think you're right; in any case, we'll end up using it very often on Py<=3.4, since ALPN support will only show up in 3.5 at the earliest (I think it's best to avoid making pyOpenSSL a hard dependency). I predict a complex interaction of Python version, OpenSSL version, and presence of pyOpenSSL will determine the available feature set for a given installation of hyper. As long as it's thoroughly documented, I don't think this is a problem. |
Mm, you've brought up an interesting point. A fun fact is that Python 3.X bundles its own copy of OpenSSL on OS X because the system copy is woefully out of date. This means that PyOpenSSL will actually regress NPN support on OS X unless you install a newer version of OS X and point PyOpenSSL at it, which is a pain in the ass. Let's make PyOpenSSL a dependency based on software version, and currently let's limit it to 2.7 to avoid breaking anything for anyone for the moment. |
Excellent plan - let's get the code out there, then progressively enable it for more environments once we understand exactly what's going on. P.S. I did not know that Py3 bundles its own OpenSSL; thanks for the heads up. So now there's the system OpenSSL, the homebrew version, and the Py3 bundled version, all having a party on my box at once. |
Yeah, it's a total mess. For some background, OpenSSL basically hasn't been updated in years, and the core dev team ended up taking the same approach as they do on Windows Python releases (which also bundle OpenSSL). The various OpenSSL compatibility issues are a nightmare, and PyOpenSSL doesn't really improve them. I'm not looking forward to telling OS X users that they need to set environment variables before installing |
What the hell is going on with code coverage? Running the tests on my Windows box gets the exact same failure, which is insane because it's pointing at lines that can't possibly be being missed. I wonder if there was an update to any of those packages recently. |
Well the last successful Travis build has the same versions of all dependencies as this one, so I'm thoroughly confused. |
Oh! You're importing from the project in |
Actually, that won't work with |
Sure, made the change, and added
I'm in favor of 2) or 3), and don't have a strong opinion on which one; they both introduce a problem that will be solved by the merging of #34, which includes the SSL compatibility layer (and hence, requires only a single definition of |
I'm in favour of 2), so let's go ahead and do that. =) |
Hey, lookit that, a green build. |
Brilliant, thanks! 🍰 🍪 ☕ 🍺 |
No problem, thanks for all your help. |
Thanks for the comprehensive test suite; it made this port a snap. The only externally-facing change I had to make was removing the magic
*
argument inHTTP20Connection.__init__()
- if you like, I can restore it on Python 3 with trickery a laSocketServerThread
.Barring the introduction of pyOpenSSL, supporting NPN is impossible on Python 2.7, so for now, the client assumes the server speaks HTTP/2.0 (referred to in the spec as "with prior knowledge").
An automatic migration tool like
2to3
was unneeded, and I think it's best to keep it that way.