Python – Using Python module on LGPL license in commercial product

licensing, python

There is written in LGPL license that I can use not modified, linked code in commercial, closed product without changing license of product to LGPL. What about Python module (*.py) on LGPL license in commercial product? Is it treated as linked code?

Best Solution

I don't think the issue (whether importing a Python module counts as "linking" with it, for the legal purposes of the GPL) has been settled yet. I don't think it will be resolved until a court case turns on it (and possibly not even then). The GPL is (sadly) written basically in terms of C and its associated tools, so it's only obvious how to apply it if the language and tools used for software have similar properties to those associated with C.

However, importing a Python module is surely at least as permissive a situation as dynamically linking to a shared library; which copyrighted document (source file) you link with when you type import foo isn't determined until the program is actually run, and can be trivially changed after your copyrighted document is produced by the end user moving .py files around on their system, or even just changing PYTHONPATH.

Personally, I find the above arguments lead clearly to the conclusion that adding import foo to your own source file doesn't "copy from or adapt all or part of [] in a fashion requiring copyright permission" at all, and thus the GPL doesn't really apply if you never modify (Quote from the GNU GPL version 3, under "0. Definitions")

(Technically I think this argument would apply to dynamically linking to a shared C library as well, except that to do so you've normally had to #include <foo.h>, which means your compiled program is a work based on foo.h even if you do argue that it's not a work based on the shared library. Although your source code would be completely unencumbered by the GPL with this interpretation, interestingly enough, so if you wanted to push the point you could distribute your source code with a proprietary license and instructions for the end user to compile themselves. But I digress.)

Not that common sense arguments necessarily match up with what a court would decide. If you treat import as "dynamically linking" with for the purposes of the (L)GPL, I do not see how you could go wrong - no one will sue you for adhering to license conditions you technically didn't have to.