-
Notifications
You must be signed in to change notification settings - Fork 204
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
WIP: Make flanker compatible with python 3 #106
Conversation
Can one of the admins verify this patch? |
We are making an effort to make flanker compatible with python 3. We prefer to avoid making a python 3 only fork and in agreement with this comment, we prefer to pull the result in mailgun's upstream. This way, flanker will be compatible with both python 2 and 3. We plan to use the excellent 'six' library and maybe 'python-future' for cross compatibility. This will have some cons like a little less code readability, but I don't think it will introduce any regression or performance difference. As this will be a rather big pull request, I will be glad to know mailgun's opinion about all this beforehand. |
@salehe I can also help out if you want and yes it would be awesome to know what @mailgun-ci wants beforehand. |
Although we are a Python2.7 shop, and foresee being one indefinitely, I would support a Python3 PR. Thanks for the contribution and good luck! |
@michi88 The hardest (and it has turned out to be very hard!) part is to realize intended types of strings in the library. The rest will be trivial using 2to3 and modernizer. My approach is to analysis the types some interesting expression take while running the test suite (take a look at https://github.com/BayanGroup/flanker/tree/strs) and do logical reasoning about the code using its semantics, specs and data flow. Then I try to do the following without breaking tests:
I believe the addresslib library and utils.py are complete now. I'm moving to addresslib tests and the the mime library next. |
@salehe Cool, I'm basically helping to move all projects I use to py3. First I need to help out at https://github.com/xhtml2pdf/xhtml2pdf as that is of higher priority for me. Will checkin here after that. |
@salehe Regardless, if you change your fork's requirements to add this commit of expiringdict, it will fix the current problem with the build in python 3. #expiringdict required by flanker, and release version of expiringdict doesn't support python3 |
…code() always return unicode
This way, we are not trying to eq check incompatible types, or call re.match on incompatible types This had some implications on parsing (URL/UNI_URL and WHITESPACE/UNI_WHITE)
Any news on that one? |
Can one of the admins verify this patch? |
Hi @kdeldycke There is a The reason is that we've migrated what is needed for flanker to be in functional parity with py3's own email module and that has lead to large code changes that I'm afraid is nearly illogical for mailgun to accept in this repo. There are some small differences (like We've been using I've been trying to not break original py27 tests (running on py27 interpreter) while making migrated tests pass on both py27 and py3 and except a few tests related to small differences that I mentioned, most of them are passing. |
Thanks @salehe for your report on the current situation! |
@salehe is it possible that this can be published to a alpha/beta PyPi repository? |
@salehe do you still want to proceed with this? We are ok to accept it, after a review, as long as none of the existing tests break for python 2.7. |
Obsolete by #193 |
Work In Progress
Make flanker compatible with python 3 (while maintaining python 2 compatibility)
Depends on mailgun/expiringdict#15 and mailgun/dnsq#7.