I am trying to find how to license my open source project, but after having spent a few hours Googling around, my head started to hurt! Instead of asking a million of questions about different licenses, I will start by explaining how exactly my project is structured:

I have developed a Python application which also calls some C++ code. The C++ code is also part of the application and it is written by me. The Python part of the code only uses libraries with MIT, BSD, and Apache 2.0 licenses. The C++ part of the code makes use of a GPL library, FFTW3. If I am not mistaken, the license of FFTW3 is GPLv2. The C++ code simply #includes the FFTW3 headers, calls the FFTW3 API functions, and links to the FFTW3 libraries. The source code of my application (available on a GitHub repository), does not include the FFTW3 source code or libraries. Furthermore, a user who wants to clone and build my application from source has the option to disable all the code that is related to FFTW3, and then compile the C++ code without FFTW3 support. In other words, FFTW3 is an optional dependency when compiling from source. Finally, I also distribute my application, along with the binaries of the C++ code and the FFTW3 libraries, on PyPI.

One thing that is absolutely clear to me is that: the version of my application that is distributed via PyPI must have a GPL license as well because the Python wheel encapsulates the FFTW3 libraries.

And here is my question now: Can I use a more permissive licence (e.g., BSD/MIT/Apache) for my source code on GitHub, and at the same time use a GPLv2 license for its PyPI binary distribution?

  • 1
    In general you're free to do whatever, but careful: Apache 2.0 and GPLv2 are not compatible. However, Apache 2.0 can be combined with GPLv2-or-later by choosing GPLv3. – amon Mar 18 at 8:42

Can I use a more permissive licence (e.g., BSD/MIT/Apache) for my source code on GitHub, and at the same time use a GPLv2 license for its PyPI binary distribution?

Yes, you can. You can even create a separate PyPI binary without FFTW3 support and distribute that under the more permissive license.

The GPL license requires that, if you use GPL-licensed code somewhere in your project or its dependencies, then all code of the project (and its dependencies) must be available under a license that is compatible with the GPL license. The GPL does not require (and probably can't legally require) that works depending on GPL code are themselves actively using the GPL license.

If you know that your project depends on GPL code, even if the dependency is optional, and you choose to use a different license for your own code, then it is very strongly recommended that you mention the GPL dependency in your licensing information in the source code, so that recipients of the source code know they may have to disable a feature to be able to keep their own code private.

| improve this answer | |

This isn't coherent. If I get code under e.g. MIT, and compile it myself, I have to comply with MIT for source and binary. If I get binaries under GPL, I have to comply with GPL, and I am entitled to source code under GPL by that same license. But then I get the code, can elect under MIT, and the first case applies.

Open Source licenses are designed to apply to source and binaries, as applicable. GPL specifically talks about whoever gets binaries is entitled to full source, no strings attached.

| improve this answer | |
  • How is this situation different from when a GPL application depends on an MIT library? Then I am also entitled to source code under GPL, but get part of it under a different license. – Bart van Ingen Schenau Mar 22 at 7:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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