Python API

Boudewijn Rempt boud at valdyas.org
Fri Jun 6 09:06:13 UTC 2014


On Fri, 6 Jun 2014, Ashley Retallack wrote:

> I know this may have been covered before but is there any thought of possibly having a python API implemented?
> We use python extensively in VFX work, to do interfaces and connections between application and for controlling asset workflow between software.

Well, we used to have one, actually, but that was very limited and hard to 
maintain. It used the kross framework to expose an api to various 
scripting languages: python, ruby, javascript. We removed it for Krita 2.6 
because it was too limited and too hard to extend.

Before that we had a javascript-based scripting api, but that got retired 
in 2006.

I have been investigating adding a PyQt or Pyside based extension api. The 
main problem is maintenance: as long as we only have demo scripts, the 
extension will bitrot, so we'll have to start doing real stuff in Python.

I prefer Python myself, because that's how I got started with Qt 
(http://valdyas.org/python/book.html -- that's more than ten years ago 
already!).

An alternative would be to use Qt's javascript scripting stuff, but I'm 
not a huge fan of that idea.

> Alternatively, what might be involved in us implementing one ourselves?

There are several possibilities:

* Contract with my company, KO GmbH to implement a python API following 
your specifications. We've got four experienced Krita developers 
available, and, well, this is exactly what KO GmbH exists for :-).

* Sponsor the Krita Foundation to add the feature. The foundation is 
pushing development of Krita in all possible ways -- we're sponsoring one 
full-time developer right now and are starting a funding campaign to 
double that.

* Implement it yourselves.The best way to do that is still to work 
together with the community. You'd need to create a new scripting plugin 
that exposes the Krita internals you need. Krita is C++ and Qt, so 
either using PyQt and sip or Pyside and shiboken, against either a 
QObject-based shim layer between the real Krita internals, or directly 
against the Krita internals. Given Krita's license, the resulting plugin 
has to be open source, and it would be best to develop that together with 
the community instead of doing a big code drop at the end of the work.


Boudewijn


More information about the kimageshop mailing list