[Python-Dev] Python 2.x and 3.x use survey, 2014 edition

Nick Coghlan ncoghlan at gmail.com
Sun Dec 14 01:14:42 CET 2014


On 13 Dec 2014 05:19, "Petr Viktorin" <encukou at gmail.com> wrote:
>
> Also keep in mind that not all Python libraries are on PyPI.
> For non-Python projects with Python bindings (think video players,
> OpenCV, systemd, Samba), distribution via PyPI doesn't make much
> sense. And since the Python bindings are usually second-class
> citizens, the porting doesn't have a high priority.
>
> If anyone is wondering why their favorite Linux distribution is stuck
> with Python 2 – well, I can only speak for Fedora, but nowadays most
> of what's left are CPython bindings.
> No pylint --py3k or 2to3 will help there...

That's a good point. I actually think
https://docs.python.org/3/howto/cporting.html#cporting-howto is actually in
a worse state than the state the Python level porting guide was in until
Brett's latest round of updates, as it covers the underlying technical
details of the incompatibilities moreso than the available tools and
recommended processes for *executing* a migration.

For example, replacing a handcrafted Python extension with a normal C
library plus cffi, Cython or SWIG generated Python bindings can deliver
both an easier to maintain extension *and* Python 3 compatibility.

Similarly, converting an extension from C to Cython outright (without a
separate C library) can provide both benefits.

It's mainly when converting to one of those isn't desirable and/or feasible
that you really need to worry about C API level porting.

For that, tools like Dave Malcolm's static CPython extension analyser for
gcc could potentially be helpful (as pylint was to Brett's update to the
Python level guide), and Lennart also provides some more detailed practical
suggestions in http://python3porting.com/cextensions.html

I'm sure there are other useful techniques that can be employed, but aren't
necessarily well known outside the folks that have been busy implementing
these migrations.

Barry, Petr, any of the other folks working on distro level C extension
ports, perhaps one of you would be willing to consider an update to the C
extension porting guide to be more in line with Brett's latest version of
the Python level porting guide?

Regards,
Nick.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20141214/04b5dd82/attachment.html>


More information about the Python-Dev mailing list