-
Notifications
You must be signed in to change notification settings - Fork 108
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
add support for python 3.3+ #9
Comments
Not something I am interested in personally, but contributions are welcome. The basic principle of porting to py3 is to
The HTML parsing, form filling etc should all mostly work with unicode already. The biggest amount of work will likelky come in migrating the test suite. |
Would you mind adding a dependency to six instead of adding if else statements everyhwere? |
In my opinion six is way too heavyweight for what it does. I prefer to just create a compat module in mechanize itself, that contains compatibility code just for the things mechanize actually needs, which I'm fairly sure will be ~ 100 lines of code. I like to restrict external dependencies only to things that are actually hard/complex to implement. |
Hello Kovid, I have commented, as referenced in the linked launchpad [1] thread. |
@davidgu I looked at the diff produced by 2to3 and IMO there si no need for a separate branch, the changes it makes can trivially be made to run on both 2 and 3. I'lll update this bug report when that is done. Note that by no means will that mean that mechanize will actually work on py3 since 2to3 really only catches cosmetic issues. |
All the (actual) issues reported by 2to3 are now fixed via the polyglot.py module. |
I too was hoping for Python 3 support and since everyone else else seems to want it too, I'd be happy to work on a port if you y'all are accepting new contributors. @kovidgoyal Who do I need to talk to? You or @jjlee ? |
me |
@nikolas Are you finished with the port? |
No. I've converted a lot of codebases from Python 2 to code that is compatible with both Python 2 and 3, and this one is exceptionally difficult! Reminds me of the difficulty converting lettuce, which is also a testing tool. Feel free to help out if you'd like to fork my branch. And sorry for messing up this thread's history with all these force-pushes. GitHub needs to fix that! Seems like a bug, not a feature :P |
I decided to expend three days of my life on this issue. All tests now pass on python3 and python2. I haven't actually used mechanize on py3, so depending on how comprehensive the test suite is, things may or may not work. YMMV. |
Cool, great work @kovidgoyal!! |
Awesome! What's the schedule for a new release? |
I'd like some real world feedback from someone actually using it with py3 before I make a release. |
what needs to be done to provide support for both python 3.3+ and python 2.7?
The text was updated successfully, but these errors were encountered: