I'm relatively new to open source, esp. in terms of collaboration, etiquette, etc. I am working on an open source library in the scientific/numerical programming domain, licensed under GPL.

There are some functions which I have not yet implemented that I have found to have already been done in another repo on GitHub, licensed under MIT. To prevent duplicate work, I am interested in incorporating parts of their code into my library, of course with attribution, etc.

I am curious as to the following however:

  • Given the differing licensing schemes, what should I do? Should I specify that those subroutines are licensed under a different scheme?
  • Should I contact the author of the other package letting them know of this?

The only thing you HAVE to do is follow the license of the code you incorporate which reads like


Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

As MIT is more permissive than GPL and compatible to it: ideally put that license in the header of the file(s) with only copied code. If that is not possible, and you need to mix licenses in one file, it gets difficult to indicate licenses clearly: put the license immediately above the routines, indicating that it applies to the routine below.

In your about text / help text / readme you also would want to give appropriate attribution so that your users (and not only those who read the source) can learn about their contribution.

You are not required to contact the authors (that's why they chose the license they chose), but sure it is a thing you can do and they might be delighted to hear that you find their work useful.

  • 3
    Aside: if you were required to contact the authors, it would not be open-source (the desert island test). May 9 '20 at 6:58
  • 1
    If you copy code with a different license into your project, I would strongly advise to keep that code in a separate source file. Having a single source file with differently-licensed code is a mess in terms of making it clear which portion is under which license. May 10 '20 at 6:56
  • @Bart good point. I made this a bit clearer in this answer May 10 '20 at 8:03

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.