3

enter image description here

I have developed a python script that makes use of a package hosted in PyPI. My code basically imports this package and uses some of its functions, together with some more functionality I developed. Now I want to distribute my script together with a requirements.txt file, so other people can use it, let's say commercially or through a permissive license such as MIT. The catch is: the package I'm importing has a GNU GPL 2 license.

The question basically is: even if I am not distributing or modifying the GNU GPL package in any way, am I forced to apply the GNU GPL license to my script, because of the dependency?

Note again that the software I will distribute is just the script and the list of dependencies I developed, so no GNU GPL software is included in my distribution. However, the final user does need to install the GNU GPL software as a requisite to run my script.

I have gone through the whole text of the license, and also through quite a few questions around here, but can't still find a clear-cut answer.

4
  • Not exactly. Certainly, in that question the python library is dynamically linked to a C/C++ extension, which in a way is similar to how I am importing another package. However the key difference here is in how my software is distributed: it does not include the package under GNU GPL, though I require the user to install it as a requirement to run my software.
    – albarji
    Commented Mar 9, 2023 at 8:56
  • 2
    How your software is distributed is actually not of any influence on your licensing obligations. Commented Mar 9, 2023 at 8:59
  • Right, but it seems to me that many terms in the GNU GPL license apply only if the licensed software is distributed, be it as a copy, as a modification, or as part of a larger software. Given the setting I described, the GNU GPL licensed software is not being distributed as part of my software; it is a requirement that the user must provide.
    – albarji
    Commented Mar 9, 2023 at 9:51
  • 1
    No, it applies if the original work or any derivative work thereof is distributed. The contention here, with which I agree, is that your simple linking of the library to your work makes your work a derivative of the library, in copyright terms.
    – MadHatter
    Commented Mar 9, 2023 at 11:57

1 Answer 1

3

even if I am not distributing or modifying the GNU GPL package in any way, am I forced to apply the GNU GPL license to my script, because of the dependency?

Yes.

The GPL license is built around the idea that if any part of the program that gets executed by the end-user has the GPL license, then the program as a whole must be under the GPL license and the source code of all parts must be at least under a GPL-compatible open-source license. This is irrespective of how the various parts get distributed and from how many sources the end-user needs to collect the parts.

The simple fact that your code contains an import statement for the GPL library and makes function calls to the library is enough to conclude that your code is a derived work, as copyright law calls it, and that you need to comply with the terms of the GPL license under which you received that library. Those terms include the requirement to use the same GPL license for your code.

2
  • The import statement could import a different package/module with the same name which isn't GPL'd. How does that work? Commented Nov 10, 2023 at 13:07
  • I also think it sounds strange that including an import statement in your code makes your code a derivative of the imported package/module, even if you don't include any of the imported code in your distribution. On the user's (or the developer's) system, the same name could refer to a different, non-GPLed package. It would depend on what's installed on the user's computer. Goes the other way, too. If you import "lib_x" which is Apache license on PyPI, but some user has swapped it out for a custom library which is GPLed, does that affect your licensing obligations? Can you cite relevant law?
    – korsbakken
    Commented May 4 at 12:23

Not the answer you're looking for? Browse other questions tagged or ask your own question.