Bug 58773 - Merging py2cairo into pycairo
Summary: Merging py2cairo into pycairo
Status: RESOLVED FIXED
Alias: None
Product: pycairo
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Steve Chaplin
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-26 08:18 UTC by Simon Sapin
Modified: 2017-07-05 15:20 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Simon Sapin 2012-12-26 08:18:11 UTC
Mailing-list message reproduced here: http://lists.cairographics.org/archives/cairo/2012-December/023843.html

I think that py2cairo should be merge into pycairo so that we get a 
single git repository and releases with a single tarball each that 
installs in both Python 2 and 3, with the same code base.

Why
---

py2cairo and pycairo are really the same project: they import the under 
the same Python name, they provide the same API, any change to one 
generally should be made to the other, some projects (such as WeasyPrint 
and CairoSVG) have the same code using either depending on the Python 
version.

More practical reasons are ease of maintenance and distribution. A 
single code base is always easier to maintain than two. Making (almost) 
the same patch twice to add the same functionality is silly. A single 
code base also reduces the risk of the two versions diverging. As to 
distribution: I hope to have a single pycairo entry in PyPI (Python 
Package Index) so that WeasyPrint can just use

     install_requires=[…, 'pycairo']

in its setup.py file. Without the merge (but assuming new releases with 
my patch to add py2cairo’s setup.py file back) every project using 
pycairo would need something like this:

     py3 = sys.version_info >= (3,)
     install_requires=[…, 'pycairo' if py3 else 'py2cairo']


Who
---

I’m willing to do the work, but first I’d like to make sure it has a 
chance of getting "upstream" in a cairographics.org release.


How
---

There are well-known techniques to have the same code running on both 
Python 2 and 3, including for C extension modules:

http://python3porting.com/cextensions.html

Some tricks can help with "polyglot" code, but the ultimate approach is 
conditional compilation:

     #if PY_MAJOR_VERSION >= 3
         /* … */
     #else
         /* … */
     #endif

The result would be more verbose than eg. py2cairo alone, but I believe 
that conditional code can be kept to a manageable minimum.

The documentation would be merge too, and the (small) Python 2/3 API 
differences be noted inline. I hope we can get HTTP redirects setup on 
http://www.cairographics.org/documentation/pycairo/{2,3}/**

At some point in the process I want to do a git "merge commit" so that 
the history of both repositories is retained, and setup tox so that 
tests can easily (and automatically) be run in multiple Python versions.


Licenses
--------

The current pycairo is under a LGPLv3 license, while py2cairo has a dual 
LGPLv2.1 / MPLv1.1 license. What does it mean for a potential merge? 
Should I keep only LGPLv3? Who do I need to ask about this?


Thoughts?
Comment 1 Simon Sapin 2013-01-07 23:18:56 UTC
I still think this is a good idea, but I have no interest in doing it myself now that I made cairocffi:

http://packages.python.org/cairocffi/
Comment 2 Christoph Reiter 2017-07-05 15:20:15 UTC
Fixed since 1.11


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.