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?

2 Answers 2


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, 2020 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, 2020 at 6:56
  • @Bart good point. I made this a bit clearer in this answer May 10, 2020 at 8:03

If possible, keep the code from each project separated, but that is not always possible, especially if you are integrating multiple scripts.

Combining Code from Multiple Projects

At the very least, you have to leave the copyright notice and permissions notice intact for MIT licensed works, but it is a good practice to create an organized list of software that is used with their corresponding licenses.

There are a couple of practices that seem to work well:

  1. Creating a Software Bill of Materials (SBOM).
  2. Putting a copy of all of the licenses in a licenses subdirectory.

Or do both.

A Software Bill of Materials (SBOM) is a file that lists all of the works used in a project, their licenses, and the version used. It usually links back to each project's home page or repository.

This does a couple of things.

  • First, it helps you stay in compliance with the MIT license because there is less of a possibility of the MIT license being accidentally deleted.
  • Secondly, it gives you and future developers a reference list of where various pieces of code came from.
  • Thirdly, it lets you know what versions of each software were used, so if there are security vulnerabilities in particular versions, you can see if you need to upgrade them.

If Each Individual File Has a Copyright Notice

In cases where each file has its own copyright notice and reference to the MIT license, you have to keep that intact, even if you modify it (unless you totally rewrite it, but that is not what we are talking about here).

If you modify the file or add code to a file, and the original file has its own copyright and reference to the MIT license, you can add text stating that the original file was based on the MIT licensed code; and that changes that were made are copyright by you (or your organization) and subject to a different license.

This contains code from {MIT licensed project name}.

{keep their copyright notice and permission notice intact.}

It has been modified by {your name or your project or your organization}

{Your copyright notice and reference to your license.}

Something like this would make it clear that the new code falls under a new license, while still retaining the previous copyright notice and permission notice as required by the MIT license.

You only have to include something like this if the license is in each and every file, and not a separate license.txt file (or something similar).

Note: you only add your copyright notice and license to the file, if and only if you actually modified the file. Otherwise, you are falsely claiming the copyright of someone else's work. Only add your copyright notice and license to files you actually modify.


At the very least, you have to include the original copyright notices and permission notice (i.e. their MIT License). But presenting that information in a more organized way would be helpful for future references and future developers and administrators.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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