Python 3 port of python-dbus

Barry Warsaw barry at
Fri Nov 18 23:00:31 UTC 2011

Hi Ubuntu Pythonistas,

This week I've been working on a port of python-dbus to Python 3, as part of
this blueprint:

python-dbus is a blocker for several of the applications we've identified as
candidates for porting to Python 3.  While the current recommendation for
Python 3 and dbus is to use the gdbus python bindings (see recent post by
Sebastian Heinlein), there are two problems with this.  First, the server side
work is apparently still pending, and second, this won't help KDE.

My secondary goal was to get more first hand experience porting a complex
Python and C library to Python 3, along with the API decisions that go along
with it.  There are several good references for porting both Python code and
extension modules to Python 3, such as:


but as I've found out, each is lacking some cases you may run across.  As part
of this work, I'll be submitting updates to those documents for the things
I've found missing, and likely blogging about the experience.

My port is fairly far along, and it being Friday after 3pm, I figured it was
worth a moment to advertise the branch so that others can take a look and
hopefully comment and contribute.

Current status is that the branch compiles, and most of the tests run without
crashing (yay!) but the test suite does not complete successfully.  Trunk
doesn't succeed for me on Python 2 either though, so that may not be a great
gauge of the health of the code.  Still, my branch hangs during the
client/server tests because some trigger is not getting through (it's
interruptable, but still the trunk makes it past this point).  So I'm still
investing this, but that shouldn't stop you from taking a look.

Once I get the test suite passing at least as well as trunk, I'll package it
up and put it in my ppa.  For now though you can grab the branch and do
something like (on 11.10 at least):

    $ PYTHON=python3.2 ./configure && make

and then fiddle with your PYTHONPATH (see the output of for

I'm especially interested in your take on some of the API changes I've had to
make, in order to resolve the ambiguities between strings and bytes, and ints
and longs.  The PY3PORT.rst file in the branch has more details:

Also, I have tried to preserve Python 2.x compatibility, where x >= 6, but
haven't tested that at all yet.

Grab the branch with:

    $ bzr branch lp:~barry/python-dbus/py3k

For now, please feel free to follow up here, or email me off-list with any
comments or feedback.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <>

More information about the ubuntu-devel mailing list