Skip to contentSkip to conversation

Python 3 support

DISCUSSION Alex Xu 4 participants 4 messages Jul 6, 2014 – Jul 7, 2014

lore
Share & tools
lore

Alex Xu

author
#0 lore raw

Please CC me on replies.

Is there any Python 3 support planned? I would like to write my libxl scripts in Python 3 instead of 2.

I tried searching the mailing list archives and Google but got no useful answers.

I tried porting Xen manually using such blunt instruments as 2to3 -w, but encountered obvious difficulties due to the complexity of the code.

Thanks in advance.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#1 lore raw
Quoted 1 line · Alex Xu

Is there any Python 3 support planned?

That would be great, but I have heard nothing of such plans.

Quoted 1 line

I would like to write my libxl scripts in Python 3 instead of 2.

[...]

Quoted 2 lines

I tried porting Xen manually using such blunt instruments as 2to3 -w, but encountered obvious difficulties due to the complexity of the code.

I have chosen to use Xen libxenlight, libxenstore and libxenctrl directly through the 'ctypes' module from my Python 3 applications (I made some custom wrappers). It is not the most elegant solution and requires careful updates for any new major Xen version, but works and can sometimes provide more or better functionality than the Python modules included with the Xen distribution (they are not very actively maintained).

Unfortunately, any upstream Xen Python utilities still depend on Python 2, so it may be hard to have a Xen system free of the old Python interpreter.

Greets,
Jacek

#3 lore raw
In reply to Alex Xu
Quoted 3 lines · Alex Xu

Please CC me on replies.

Is there any Python 3 support planned?

Not specifically, although it certainly would be nice to get done.

Quoted 2 lines

I would like to write my libxl
scripts in Python 3 instead of 2.

Which bits are you looking for py3 support with?

Quoted 7 lines

I tried searching the mailing list archives and Google but got no useful answers.

I tried porting Xen manually using such blunt instruments as 2to3 -w, but encountered obvious difficulties due to the complexity of the code.

The compiled python extensions shouldn't be too hard to adjust to being Py3 compatible. There are a standard set of macros used for making Py2 and Py3 .so's from a single source.

The python scripts however are rather more difficult. For better or for worse, our current support statement is for Python 2.3 and later, which vastly limits the ability to make join Py2/Py3 single .py files

Changing the supported version to 2.4 would help a little, but wouldn't make it much easier. We certainly can't move the minimum supported version to anything newer than 2.4 for the forseeable future, as RHEL/CentOS 5.x era OSes are still in supported and active use.

There is probably some work which can be done to make 2to3 more effective.

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#2 lore raw
In reply to Jacek Konieczny
Quoted 10 lines · Jacek Konieczny
Quoted 1 line · Alex Xu

Is there any Python 3 support planned?

That would be great, but I have heard nothing of such plans.

Quoted 1 line

I would like to write my libxl scripts in Python 3 instead of 2.

[...]

Quoted 2 lines

I tried porting Xen manually using such blunt instruments as 2to3 -w, but encountered obvious difficulties due to the complexity of the code.

Quoted 7 lines

I have chosen to use Xen libxenlight, libxenstore and libxenctrl directly through the 'ctypes' module from my Python 3 applications (I made some custom wrappers). It is not the most elegant solution and requires careful updates for any new major Xen version, but works and can sometimes provide more or better functionality than the Python modules included with the Xen distribution (they are not very actively maintained).

For all intents and purposes you should consider the libxenlight Python bindings to simply not exist. They are not maintained nor built by default and don't really work. If someone wanted to resurrect them I would strongly encourage them to start from scratch...

The xenstore and xenctrl modules should be in a better state, although they are no longer widely used by the default toolstack now that xend is removed, but we would accept patches etc and they are build tested as part of our normal process.

Quoted 11 lines

Unfortunately, any upstream Xen Python utilities still depend on Python 2, so it may be hard to have a Xen system free of the old Python interpreter.

Greets,
Jacek

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel