Comments on Python 3 support for Distribute.
Hiya all! Tarek alerted me to that Martin v Löwis has checked in the great job done during the DZUG-sprint of adding Python 3 support to the 0.6 maintenance branch. I tested it yesterday, and I have two comments. 1. First a little heads up!! When I tested this yesterday, I first ran the tests for various Python versions, and then I tried to install it on Python 3.1. Unfortunately I got a syntax error. Something was not properly converted to Python 3. Looking at the source code of the file in question showed that it WAS converted. I thought it was the PYC-file, but then I realized you can't get syntax-error in pyc-files. I deleted all in site-packages, and ran the install again: Same result. Finally I fixed it by deleting all in site-packages, and rm -rf dist build in the distribute checkout and also deleting all pyc-files in the distribute checkout and trying again. Since then, I have not been able to repeat the problem. (Deleting just build and dist or just the pyc-files or just everything in site-setup did not work. Only when I deleted *all* of these did the problem go away). I suspect that the existence of my setuptools port in the Python 3.1 install before running the new one made something very strange. But it made the strangeness in either build/ or dist/. So a heads up to everyone here: If you have used my setuptools port, make sure you delete all traces of it from your Python 3 install *before* attempting to install Distribute on Python 3. 2. There is now a build_py that will run 2to3 on the code. That's cool, but there doesn't seem to be a way to enable it. It looks for a setuptools.use_2to3 attribute to check if it should be used, but I couldn't see a way of setting that. Passing it in as a parameter to setup() gives you a warning, that the parameter is unknown. How should it be done? -- Lennart Regebro: Python, Zope, Plone, Grok http://regebro.wordpress.com/ +33 661 58 14 64
2009/9/18 Lennart Regebro
2. There is now a build_py that will run 2to3 on the code. That's cool, but there doesn't seem to be a way to enable it. It looks for a setuptools.use_2to3 attribute to check if it should be used, but I couldn't see a way of setting that. Passing it in as a parameter to setup() gives you a warning, that the parameter is unknown.
How should it be done?
OK, seems i can do this with import setuptools setuptools.run_2to3 = True -- Lennart Regebro: Python, Zope, Plone, Grok http://regebro.wordpress.com/ +33 661 58 14 64
Lennart Regebro kirjoitti:
2009/9/18 Lennart Regebro
: 2. There is now a build_py that will run 2to3 on the code. That's cool, but there doesn't seem to be a way to enable it. It looks for a setuptools.use_2to3 attribute to check if it should be used, but I couldn't see a way of setting that. Passing it in as a parameter to setup() gives you a warning, that the parameter is unknown.
How should it be done?
OK, seems i can do this with import setuptools setuptools.run_2to3 = True
This should not be necessary. The run_2to3 keyword argument to setup() is the way to go. I haven't had a good chance to check out Martin's work, but if that option is missing, I'll add it.
2009/9/18 Alex Grönholm
This should not be necessary. The run_2to3 keyword argument to setup() is the way to go.
Yeah, but that's not added. But if all others agree that a keyword is better then we should go with that.
I haven't had a good chance to check out Martin's work, but if that option is missing, I'll add it.
Nah, I'll already added it, but not pushed it yet. :) I want confirmation from the list, and some more testing. (I'm using zope.interface as a testing platform at the moment). -- Lennart Regebro: Python, Zope, Plone, Grok http://regebro.wordpress.com/ +33 661 58 14 64
2009/9/18 Lennart Regebro
2009/9/18 Alex Grönholm
: This should not be necessary. The run_2to3 keyword argument to setup() is the way to go.
Yeah, but that's not added. But if all others agree that a keyword is better then we should go with that.
+1
I haven't had a good chance to check out Martin's work, but if that option is missing, I'll add it.
Nah, I'll already added it, but not pushed it yet. :) I want confirmation from the list, and some more testing. (I'm using zope.interface as a testing platform at the moment).
Also, a full example on "how to use distribute with python 3" in the docs/ would be nice to have. btw, I propose to release 0.6.2 as soon as py3 support has been tested by a few more people. Tarek -- Tarek Ziadé | http://ziade.org | オープンソースはすごい!
2009/9/18 Tarek Ziadé
Also, a full example on "how to use distribute with python 3" in the docs/ would be nice to have.
Absolutely.
btw, I propose to release 0.6.2 as soon as py3 support has been tested by a few more people.
Right. I'm working on also reimplementing the rest of the 2to3 options into keywords, and I'll make a quick documentation of this, and notify people here. Should be done today or tomorrow. -- Lennart Regebro: Python, Zope, Plone, Grok http://regebro.wordpress.com/ +33 661 58 14 64
2009/9/18 Lennart Regebro
Right. I'm working on also reimplementing the rest of the 2to3 options into keywords, and I'll make a quick documentation of this, and notify people here. Should be done today or tomorrow.
Checked in. Also made the test command run 2to3 if necessary. It now works on my zope.interfaces Python3-branch. Will try to document this during the weekend. -- Lennart Regebro: Python, Zope, Plone, Grok http://regebro.wordpress.com/ +33 661 58 14 64
* Lennart Regebro
2009/9/18 Alex Grönholm
: This should not be necessary. The run_2to3 keyword argument to setup() is the way to go. I haven't had a good chance to check out Martin's work, but if that option is missing, I'll add it.
Nah, I'll already added it, but not pushed it yet. :) I want confirmation from the list, and some more testing. (I'm using zope.interface as a testing platform at the moment).
The idea of this *not* being a setup() argument was to keep compatibility with setuptools (since it will complain about arguments it doesn't understand). This would enable a package to use setuptools or distribute (or whatever ;) for python2, and only require distribute for the python3/2to3 goodness. Wolfgang
2009/9/19 Wolfgang Schnerring
The idea of this *not* being a setup() argument was to keep compatibility with setuptools (since it will complain about arguments it doesn't understand). This would enable a package to use setuptools or distribute (or whatever ;) for python2, and only require distribute for the python3/2to3 goodness.
Ah, OK. Well, I added the extra parameters in via an **extras dict in zope.interfaces, so I didn't think of that. Still, I probably prefer that we keep one API, and not two. :) The warning that you'll get under setuptools is not an actual problem is it? -- Lennart Regebro: Python, Zope, Plone, Grok http://regebro.wordpress.com/ +33 661 58 14 64
* Lennart Regebro
2009/9/19 Wolfgang Schnerring
: The idea of this *not* being a setup() argument was to keep compatibility with setuptools (since it will complain about arguments it doesn't understand). This would enable a package to use setuptools or distribute (or whatever ;) for python2, and only require distribute for the python3/2to3 goodness.
The warning that you'll get under setuptools is not an actual problem is it?
Ah, Martin and I thought that it would produce an *error*, but we didn't actually check that AFAIR. I just did, and you're right, it's just a warning -- and that's not a problem, I think.
Still, I probably prefer that we keep one API, and not two. :)
Very much agreed, let's use setup() arguments. Wolfgang
2009/9/21 Wolfgang Schnerring
Very much agreed, let's use setup() arguments.
Great. I've checked in some docs too, I expanded the section on Python 3 support and ended up creating a new document, python3.txt. Feedback on that is appreciated. Also, feedback on the naming of the keywords is appreciated. Yes, I know it's bikeshedding, but I find the current parameter names clunky, but have no better ideas. ``run_2to3`` Convert the source code from Python 2 to Python 3 with 2to3 during the build process. ``convert_doctests_2to3`` List of doctest source files that need to be converted with 2to3. See :doc:`python3` for more details. ``additional_2to3_fixers`` A list of modules to serach for additional fixers to be used during the 2to3 conversion. See :doc:`python3` for more details. If better names for these can be invented before the first release that would probably be beneficial. (run_2to3 I find OK, though, it's basically the other ones). -- Lennart Regebro: Python, Zope, Plone, Grok http://regebro.wordpress.com/ +33 661 58 14 64
* Lennart Regebro
Great. I've checked in some docs too, I expanded the section on Python 3 support and ended up creating a new document, python3.txt. Feedback on that is appreciated.
Excellent! I think that covers it pretty well.
Also, feedback on the naming of the keywords is appreciated. Yes, I know it's bikeshedding, but I find the current parameter names clunky, but have no better ideas.
My favourite colour: use 2to3 as the prefix (consistency helps, I think), like so: 2to3_enabled, 2to3_convert_doctests, 2to3_fixers, ... Wolfgang
2009/9/21 Wolfgang Schnerring
My favourite colour: use 2to3 as the prefix (consistency helps, I think), like so: 2to3_enabled, 2to3_convert_doctests, 2to3_fixers, ...
That works. Maybe just 2to3_doctests? -- Lennart Regebro: Python, Zope, Plone, Grok http://regebro.wordpress.com/ +33 661 58 14 64
participants (5)
-
Alex Grönholm
-
Lennart Regebro
-
Tarek Ziadé
-
Wolfgang Schnerring
-
Wolfgang Schnerring