[libvoikko] Porting libreoffice-voikko to Python

Harri Pitkänen hatapitk at iki.fi
Sun Sep 6 20:05:42 EEST 2015


I have started a rather large task of porting the entire libreoffice-voikko to 
Python. The work will be done on a separate branch (port-to-python). Do not 
even try to build or run this branch, it will not work.

It may seem strange that I want to insert Python code between an application 
written in C++ and a library written in C++. But there are many benefits in 
doing this and the situation is rather similar to Mozvoikko when it was ported 
from C++ to JavaScript.

 * The C++ code is complicated and the build system around it is quite
   fragile. Right now there are no problems but Makefile is already a mess of
   platform specific tweaks. Python code will be simpler and there won't be
   a build system to maintain at all, just a simple Makefile needed for
   placing the files in a zip package.

 * ABI between LibreOffice and the extension is very much compiler specific.
   This is a problem on Windows where we need to use MSVC to build the code
   which will introduce a dependency to specific MSVC runtime library. For
   licensing reasons we cannot include that runtime in the extension. We have
   to hope that the user either has that runtime or follows the instructions
   to install it. For now we have used MSVC 2005 and it appears that recent
   systems almost always have the runtime libraries for it. But recently my
   build laptop broke and on my new Windows development laptop I had to
   install MSVC 2013. Thus if I were to compile a new version for Windows
   I would need to use the new compiler and that might again trigger the need
   for users to install the correct runtime -> lots of complaints to be
   expected.
   When libreoffice-voikko is written in Python this problem no longer exists.
   While we still need to include libvoikko which is written in C++ we can
   use any compiler we like to build it. And we like GCC because we are
   allowed to include its runtime libraries in the extension.

 * Less incompatibilities expected due to API/ABI changes. We have been lucky
   during the past years as we have had very few cases where a new release of
   LibreOffice has broken the extension. But this has simply been good luck,
   it could have been much worse. In Python it is somewhat easier to
   dynamically adapt to API changes.

 * Use of C++ for writing extensions for LibreOffice is very rare. We are
   already almost the only project that still does that seriously. Python on
   the other hand is widely used these days. Even the built in grammar checker
   in LibreOffice (Lightproof) is written in Python. Continuing with C++ would
   in the worst case mean that we would need to take an active role in
   maintaining the SDK and this is something I don't want to even think about.

In practice this means that I will stop working on the C++ version of 
libreoffice-voikko immediately. There is one feature implemented on the C++ 
side that has not been part of a stable release: support for languages that do 
not have even the basic locale data in LibreOffice. That code seems to work 
though so those who need it can build it from master even if we have not 
tagged a release for it.

There is no timeline promised for completion of this work. But having it done 
before the end of this year would allow supporting 64 bit LibreOffice on 
Windows before it is labeled the "still" release and suggested for enterprise 
use. Hopefully that is doable.

Harri


More information about the Libvoikko mailing list