Forking baazar to add Python 3.x support

William Grant william.grant at
Fri Mar 7 06:53:28 UTC 2014

On 07/03/14 11:28, Richard Wilbur wrote:
> On Thu, Mar 6, 2014 at 7:05 AM, Bob Tanner <tanner at> wrote:
>> I think dropping support for Python 2 would be a mistake at this point in
>> time.
> What reason(s) did you have in mind?

Bazaar isn't just an application, but a library too, and the centre of a
plugin ecosystem. An immediate breaking transition from Python 2 to 3
would render all plugins and consumers of bzrlib unusable until they
were ported -- and bzrlib consumers might not be portable to 3 in the
short term if they depend on other 2-only libraries. The Python 2
version of Bazaar would end up being maintained in parallel, scarily
similar to the Python 2 vs 3 situation itself.

Additionally, porting all 360,000 lines of Bazaar code at once is going
to be time-consuming and fraught with bugs. It's likely far more
practical to gradually port the various modules to 2+3 from the bottom
up, leaving the test suite runnable on 2 to ensure that the partially
ported project still works as a whole, throughout the long-term port

> My understanding of the differences between Python 2 and Python 3
> imply that depending on the level of coding sophistication it could
> require significant work to support both in the same files.  Then
> again, this could also be a good step in the right direction for the
> bzr code base.  Evidently Armin Ronacher's python-modernize[1] is a
> tool that can help with this process.
> I can think of a few reasons it could be a real challenge to port bzr
> to Python 3:
> 1.  bzr currently represents a relatively mature software project with
> a non-trivial volume of Python 2 code.  Any syntax changes may affect
> a lot of code requiring significant re-factoring.  (The 2to3 tool
> should help here.)

2to3 is almost always a bad idea, and I'd only ever consider it for a
leaf application. The syntax changes are small enough that it's usually
easy to write code that runs on 2.6+ and 3.2+ simultaneously, and there
are many helper libraries around to deal with the semantic differences.

> 2.  Any changes in semantics that don't break syntax won't be caught
> by the language, so will require tracking down as bugs or failed test
> cases.  (Anyone familiar with the 2to3 tool's track record on these
> types of changes?)

Bazaar fortunately has an excellent test suite, which can be run on each
module as it's ported.

> 3.  Library dependencies will need to be updated.  Libraries that
> haven't been ported to Python 3 will require porting or re-factoring
> the bzr interface to use a library that already supports Python 3.

Core Bazaar doesn't have many external dependencies, so this shouldn't
be a huge problem.

> Nevertheless, Python 3.x is receiving the bulk of the new development
> effort and cleans up Unicode/encoding handling for strings, among many
> other things.[2]

Python 3 is certainly the future. But in a lot of places it's still just
that -- in the future. Python 2 will remain in the present for many
users for a good few years, and forcing people who are stuck on 2 to
fork Bazaar isn't going to do much good for anyone.


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

More information about the bazaar mailing list