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
Python 3 support #16
Comments
there's no way to get code that will run on both python 2 and 3, is there? :( |
Paramiko is much too large and io heavy to make that realistic. You could get the two codebases (paramiko py2 and py3) very similar if you started with a py3 version and downported to 2.6 or 2.7. But the current paramiko works well on 2.6 and older, so I don't see a lot of value in that. |
Hello, You can have a single codebase for python 2 and python 3. In the setup.py add the conversion 2to3. This is the recommended way. Add the following code to the setup.py try: This is the recommended way: http://wiki.python.org/moin/PortingPythonToPy3k |
Using 2to3 was the first step I took for the port and it did convert a lot of things, but it didn't do anything for the massive str/bytes separation that had to take place. Now I don't know a lot about it, but 3to2 might have more potential for paramiko. |
I am working with it now. Since paramiko development seems to be stopped (no reply from the author for months), I am using the ssh fork https://github.com/bitprophet/ssh |
Cool, let me know how you make out or if you have any questions. |
Hi, Is there any progress on that? Is https://github.com/bitprophet/ssh the best implementation in python3? Thank you! |
@sciunto That 'ssh' fork will merge back into this one shortly, for what it's worth. It's also not Python3 compat yet, though there are patches. Speaking personally, Python 3 support is a medium priority -- my hope is for Fabric 2.x to be Python 2.6=>3.x compatible, and that will require doing the same for some Paramiko version. For Fabric and my other projects, I'm hoping to go the "one codebase that works on both Python versions" approach. As mentioned above, I'm not sure if that is feasible for Paramiko due to it being bigger, more complex and more IO oriented. I also haven't experienced the joy/sadness of 2to3/3to2 yet -- if they work and don't make maintenance a huge pain, awesome. If not, hard to say what will happen. |
Alright. I'm going to limit my codes to some popen calls until things evolve. Thanks a lot for your reply and your work |
For the record, the python 'ssh' lib has now merged back into Paramiko (as of tonight). Nothing else has changed yet re: investigating the least painful Py3k route for Paramiko itself -- but as I start to work on Fabric 2.x, this will become increasingly important to me, so look for updates in the nearish future. |
Any updates or an ETA on a py3k version? |
any news about py3k version? |
No py3k news yet, it is still definitely planned (see my above comment), but other priorities have to come first :( |
I will just add my encouragement here. paramiko is great and I would really like to see it for Python 3. |
I wrote a python library pyzmail that work for both python 2 and 3. The most difficult part is about unicode string and unicode literal. pyzmail use a lot of both. At 2 or 3 place I had no other choice than test check the python version and write specific code for both version. paramiko don't make an heavy use of unicode string then it should be possible to use the same way. |
Not quite: Particularly in the agent stuff, it should be using Cheers, Michael On Mon, Mar 4, 2013 at 1:26 PM, Alain Spineux notifications@github.comwrote:
|
By "using unicode", I mean having bytestring to convert to 'human' readable strings and vice versa. |
I'd like to voice my support for this issue as well. @bitprophet You should definitely go for the single code base approach. If you only need to support 2.6, 2.7 and 3.3+ this is very feasible. |
It looks like need to support two different code bases: for python 2.x and 3.7. I'm trying to port paramiko to 3.3 but it really hard to suport 2.x and 3.x in one codebase. |
What is your main problem ? Do you have some recurring piece of code that require some changes ? Does this make the code difficult to read ? Are you using 2to3 in POST-process (after you have made the original code for 2.x , 3.x ready )? |
Yes, I'm using 2to3. Main problem is new types: no long and unicode more. I'm pretty sure that that it will broke 2.x code or code will be difficult to read with a lot of try-except blocks |
I've been actively porting my (much smaller & newer) projects Spec and Invoke to a shared 2.6+3.3 style codebase using six, an approach that not only everybody who's already done this has recommended, but which does seem to work quite well in practice. The transition's been thorny but only because I hadn't done any work with Python 3.x prior so I'm both porting + learning. I expect any final Paramiko Python 3.x support will end up using |
@e0ne it's not that hard. instead of making crazy amounts of try/except blocks, make a function that has that in it. i maintain a daily use set of software that is approaching 10K lines and has to work on everything from 2.4 to 3.3 |
also, i find it much easier to write for py3 and then handle legacy breakage as exceptions to the norm. it makes dealing with issues a lot easier. |
@FirefighterBlu3 thanks for advise. I'll try it. I'm newbie in porting to python 3.x. I'm working on Lettuce and wont to get fabric/paramiko on python 3.3 in my project. |
no problem. i'd love to see a py3 capable paramiko. i'd port it but i'm really really pressed for time. i prefer a single branch |
Please update the Fabric documentation; it now reads "Fabric is a Python (2.5 or higher) library", which implies 3.x support. Only after installing with pip and seeing syntax errors fly by, did I get suspicious about the 3.x support... |
@sybrenstuvel Most folks realize Python 3 is a big break from Python 2...but clearly not everybody. Fixed: fabric/fabric@a722a7c - thanks! I just completed #256 so it is now officially PYTHON 3 TIME and I will dive into the above PRs next time I have OSS time. |
When you start actually using Python 3 you realize that it's not actually that big of a break. |
@asmeurer Sure, it's no Perl 6 ;) but it's enough of a barrier that I would never expect a project to default to supporting 3 if it just says "Python 2.5+". (Especially if it says 2.5+, given supporting 2.5 and 3 at the same time is even harder ;)) |
Mostly done applying #236's changes on top of latest master, taking notes as well. Plan is to present a new, clean PR with that changeset; discuss my notes on it (probably in that PR, just because it makes line comments easier); then iterate until we're satisfied. |
#276 is that PR. Please put any interested eyes on that copy of the code, and I will be posting progress there as I hack on things. |
We're basically done with #276, got test suite parity + did some cleanup + a little remaining that is being handled now. What's left, IMO:
|
Was randomly poking https://caniusepython3.com/ and realized it's asserting |
https://github.com/warner/python-ecdsa |
The latest released version (0.10) has no trove classifiers indicating which Python versions are supported, but there is a commit claiming support for both 2.x and 3.x. |
Nice work guys! The reason I posted a comment about the "2.5+" thing, is that I'm trying to get "X and newer" to actually mean "X and newer", and not "X and newer except fo other new stuff" ;-) |
Smart move to release and move forward. Too many projects get stymied by fear of issues. |
Congrats. And thank you all. |
👍 💯 |
Hope py3 supporting will come soon! |
@leafonsword there is, since 1.13.0. |
@tshepang |
Error from python 3.4.3: |
@TeeBSD could you |
Paramiko uses pyCrypto. |
sshclient: detect allowed authentication types
I have Paramiko running on Python 3 at https://github.com/goertzenator/paramiko
All unit tests, except for sftp, pass. Needs documentation updates for the many str -> bytes changes.
Looking for advice on what to do with this. Adding a python 3 branch to paramiko would have a lot of complications...
The text was updated successfully, but these errors were encountered: