Maintaining a backported module

Ben Finney ben+python at benfinney.id.au
Thu Oct 24 01:09:55 EDT 2013


Steven D'Aprano <steve at pearwood.info> writes:

> I'm now at the point where I wish to backport this module to support
> versions of Python back to 3.1 at least and possibly 2.7, and put it
> up on PyPI.
>
> I'm looking for advice on best practices for doing so. Any suggestions 
> for managing bug fixes and enhancements to two separate code-bases 
> without them diverging too much?

It is a great advantage that you've targeted Python 3 primarily. As I
understand it, it is far easier to make an existing Python 3 code base
also work on Python 2, than vice versa.

(Though that will obviously change as Python 3 continues to diverge from
Python 2. The more one depends on Python 3 features, the more one
depends on back-ported versions of those features for Python 2.

I'm pretty sure that's not going to be much of an issue for the
‘statistics’ package, but it's worth mentioning as a general caveat.)

> Other than "Avoid it" :-)

A useful library for this purpose is ‘six’ (as in “3 × 2”)
<URL:http://pythonhosted.org/six/>. You can use its features to do
things that are useful or better in Python 3, but which need special
implementation to work on Python 2; and the same code will just work on
both versions.

-- 
 \         “Pinky, are you pondering what I'm pondering?” “I think so, |
  `\    Brain, but if we get Sam Spade, we'll never have any puppies.” |
_o__)                                           —_Pinky and The Brain_ |
Ben Finney




More information about the Python-list mailing list