Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Python 3 Migration #484

Closed
neilchaudhuri opened this Issue · 6 comments

4 participants

@neilchaudhuri

I am considering building the website for my company with Mezzanine, and I am curious if migration to Python 3 is on your project radar. Thanks.

@stephenmcd
Owner

Will definitely happen at some point - no specific time planned yet.

Let's leave this issue open to track its progress.

@gwideman

@stephenmcd Any update on this issue?

@stephenmcd
Owner

No. Are you interested in working on it?

@edschofield

Hi Stephen,

I'm interested in helping with the Py3 port. I'm the main author of the future package for Py2/3 compatibility and I did the Py2/3 port of xlwt.

Are you willing to drop compatibility for Python versions below 2.6? I see in .travis.yml that the tests are run only on Python 2.6 and 2.7, so I'm guessing this won't be a problem.

I would submit two pull requests. First would be the result of passing mezzanine through stage 1 of futurize. This would still be working Python 2 code, but with __future__ imports at the top of each module and Py2/3-compatible modernizations made to the coding style.

After you have merged this pull request, stage 2 would be a much smaller patch. This would introduce a dependency on the future package and provide support for Python 3 in addition to Python 2.

The advantage of using this approach versus a combination of six and manual hacks is that your code will be cleaner and more maintainable, and there will be fewer bug-causing differences between the Py2 and Py3 behaviour (e.g. from the bytes object).

Let me know if you're happy for me to proceed. :)

@stephenmcd
Owner

Hey Ed, this is incredibly welcome! My friend Anthony Menasse forwarded me your email from the Melbourne PUG I believe, and I was really excited to read about it.

I do have some very slight hesitations around use of the future library, as I'd not heard of it before and there doesn't seem to be much popularity around it from what I can quickly gauge. But with that said, you're the first and only person who has offered to deal with Python 3 support in Mezzanine, and this is the most important chunk of work that needs doing right now, so I think we'll just need to take a little leap of faith here lest we remain stuck on Python 2 forever :-)

So yes, please go right ahead, and thanks a lot for your help with this.

@edschofield

Hi Stephen,

Thanks for your faith and encouragement.

future is only a few months old, but it already has a comprehensive test suite (300+ tests). I am confident that it will be a safe, clean option. I am also committed to maintaining it well if any issues do crop up. I hope that many other packages will soon also decide to use it to provide Py2/3 support.

I have now applied stage 1 of futurize and I will send a pull request. The patch is 553 lines: mostly conversions to print() functions and the except Exception as e syntax.

@stephenmcd stephenmcd closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.