Skip to content

Merged-to-master Python 3 branch - #276

Merged
bitprophet merged 85 commits into
masterfrom
python3
Mar 14, 2014
Merged

bitprophet merged 85 commits into
masterfrom
python3

Conversation

@bitprophet

Copy link
Copy Markdown
Member

How I got here:

$ git checkout scottkmaxwell/py3-support-without-py25
$ python test.py # verified
$ git checkout -b python3 master
$ git merge scottkmaxwell/py3-support-without-py25 -Xignore-space-change

Then poking at all the conflicts, some of which required the following (given that I shuffled some files around in #256, this made it a lot easier to figure out what the incoming branch had actually changed):

$ git show master:paramiko/<module>.py > paramiko/<module>.py
$ vim paramiko/<module>.py
$ git diff 28d78e4e6a33d2e23af196db632e6eeda4167e24 scottkmaxwell/py3-support-without-py25 -- paramiko/<module>.py
<manually apply changes as needed>

And now trying to ensure that the test suite passes again.

@bitprophet

Copy link
Copy Markdown
Member Author

@asmeurer Yea I saw that when it was first publicized but it felt sufficiently less mature than six (which is saying something ;)) that I didn't really jump on it.

@bitprophet

Copy link
Copy Markdown
Member Author

OK, I bumped the six/whatever thing to #277, @scottkmaxwell is wrapping up the star import fixes, and everything else on my list has been explained away. Once we merge his changes I will merge this PR and go back to #16 for last steps.

@asmeurer

asmeurer commented Mar 8, 2014

Copy link
Copy Markdown

I personally agree with @scottkmaxwell about just using your own compatibility file. Even for very large projects they are not very large, and if anything, they can help you to learn the differences between the two.

The advantage of using a library like six or futures is that some of the changes can be subtle, and especially if your tests aren't great (I don't know how they are for Fabric or Paramiko), you can miss things. For example, just the other day I discovered that in Python 3, math.ceil returns an int, whereas in Python 2 it returns a float. That's typically not a big deal, except I was trying to multiply a list by the result, and Python only lets you do that with an integer.

@bitprophet

Copy link
Copy Markdown
Member Author

Even for very large projects they are not very large

Sure, but I maintain it's no different from any other library/code-reuse use case, and as somebody with a half dozen or more projects, I loathe copy-pasting the same crap between projects for no good reason :)

In a project of this size & with this much low level tomfoolery, we'll need some custom shim code no matter what, but I'd be very surprised if we couldn't replace a good chunk of common functionality with six/future/etc.

But again, this is now a discussion for #277 :)

@scottkmaxwell

Copy link
Copy Markdown
Contributor

Fix is in. I also fixed a bunch of PEP8 issues that PyLint complained about. Lots of stuff like if x != None: where it should be if x is not None:.

https://github.com/scottkmaxwell/paramiko/tree/python3-with-import-fix

@scottkmaxwell

Copy link
Copy Markdown
Contributor

BTW, PIP also does their own compat layer.

@scottkmaxwell

Copy link
Copy Markdown
Contributor

@bitprophet I added a few inline comments to GitHub here: scottkmaxwell@f0017b8

Explaining why I made certain changes. All of the formatting changes in this branch are ones that were flagged by the PEP8 scanner built into PyCharm.

There is only one import * left, and that is in a unit test that is specifically ensuring that the paramiko module has all expected elements.

@derekchiang

Copy link
Copy Markdown

@bitprophet I was trying out the Py3 branch and I noticed that event.src_path and event.des_path are bytes in Py3 and str in Py2. Is this intentional? I think it makes more sense to convert them to str in Py3 and unicode in Py2.

@bitprophet

Copy link
Copy Markdown
Member Author

@scottkmaxwell Sweet deal, thanks! And +1 on more PEP8 fixes, me and PEP8 agree 99% of the time. I'll merge & test that out ASAP.

@derekchiang I don't know offhand, depends who first indicated that change during this process (this branch is built on a bunch of folks' earlier work, even if the Git history is mostly myself and @scottkmaxwell). I'll look quickly but if those are just file paths I think I'd agree with you.

@bitprophet

Copy link
Copy Markdown
Member Author

@derekchiang I don't even see those terms in the codebase, actually, can you provide a specific link?

@scottkmaxwell Merged & all tests pass incl Fab's suite on Py2 \o/ thanks again!

@bitprophet

Copy link
Copy Markdown
Member Author

Right, forgot that doc building still doesn't work under Py3 for some dumb reason, even though Jinja is supposed to be Py3 compat? But that's not a huge concern at the moment so I may just tell Travis to skip that step under Python 3 for now.

@bitprophet

Copy link
Copy Markdown
Member Author

Confirmed that even Jinja2 2.7 breaks under Python 3, so yea, updating the travis.yml for now :( EDIT: hm except it seems to work on one of my other dual interpreter projects, so perhaps the error message is misleading. Digging. EDIT 2: Yea, was a stray iteritems() in the theme extension (Alabaster). Fixing.

@bitprophet

Copy link
Copy Markdown
Member Author

That seems cleared up now. I...I think we can merge? SO SCARED

bitprophet added a commit that referenced this pull request Mar 14, 2014
Merged-to-master Python 3 branch
@bitprophet
bitprophet merged commit 0424f2c into master Mar 14, 2014
@derekchiang

Copy link
Copy Markdown

Cheers!!!!!!!!!!

@scottkmaxwell

Copy link
Copy Markdown
Contributor

Yay!

@aliceinwire

Copy link
Copy Markdown

Congratulation :)

@bepetersn

Copy link
Copy Markdown

Sweet! Great job. So Jinja2 wasn't an issue?
On Mar 14, 2014 3:02 AM, "Alice Ferrazzi" [email protected] wrote:

Congratulation :)

Reply to this email directly or view it on GitHubhttps://github.com//pull/276#issuecomment-37624293
.

@jpadilla

Copy link
Copy Markdown

Great work!

dkhapun pushed a commit to cyberx-labs/paramiko that referenced this pull request Jun 7, 2018
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.

10 participants