supporting python2 and python3 in kdevelop

Milian Wolff mail at
Mon Nov 4 14:14:38 UTC 2013

On Monday 04 November 2013 14:13:15 Sven Brauch wrote:
> Hi!
> I'm wondering if there's an easy way to support both python2 and python3 in
> kdevelop. I have working branches for both versions, but merging them into
> one plugin with a switch is not feasible for a variety of reasons. It would
> result in code having lots and lots of if(python3) {...} which I can't
> maintain.
> So, apart from the "dumb" method of supporting both (which is providing two
> packages which conflict and the user can switch on a package-level) it would
> be very cool to have it selectable in kdevelop -- python2 will be around
> for quite a while (I don't think it'll disappear any sooner than five
> years, since various major projects still have not switched).
> I think this would mean writing a Python project manager (which makes sense
> anyways), which would need to have a word in which language plugin is used
> for a file -- i.e. the project manager would need to influence
> ILanguageController::languagesForUrl().

Personally, I'd try to merge the codebases since having two branches will be a 
nightmare for release management among other things.

Note that I don't suggest merging on a file level, rather on a 
branch/repository level. I.e. have a python2 and a python3 folder or similar 
in your plugin base folder.

Thus, you also only have on ILanguageController (but two ParseJobs etc. pp.).

Adding configuration for your plugin to a project is also possible, no need 
for a new project manager. Then the user can specify whether a given project 
(or even file, if you want to support that) is python2 or python3.

Milian Wolff
mail at

More information about the KDevelop-devel mailing list