I ported a MATLAB repository to Python, with former having this two clause BSD License reading:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

In addition to this not being a plain fork but rewritten in another language, I've implemented multiple fixes, performance optimizations, functionality extensions, and readability and documentation improvements to the point that some functions hardly resemble original. Further, I'll be adding more functions entirely of my own and from other projects with their own licenses. By percent, it'll be approximately (with 3 & 4 only growing in time):

  1. 20% of original's rewritten in Python with minimal changes
  2. 30% of original's with significant or 'total' changes
  3. 20% entirely new functionality
  4. 30% from other projects with their own licensing

I credit the authors' relevant publications and hyperlink to repository in every method docstring, also reference both in README. Do I still need to include the whole license copy in my license (to-be Apache 2.0)? Then also for functions I take from other projects with same licensing, no matter how few?


1 Answer 1


You must keep the BSD license notice intact for as long as your project is derivative of BSD-licensed software, for example because it still contains some BSD-licensed parts. Whether a project is still derivative after a rewrite is somewhat unclear as discussed in other questions here. But if you aren't really really sure that you've entirely replaced all old parts, you should assume that your project is still derivative. This is not primarily about licenses: this is about the original authors' copyright in this software.

The same reasoning applies when taking functions from other projects: you're only allowed to take them if you comply with their license.1 For licenses like MIT or BSD this is very easy because you just have to keep the license notice intact somewhere.

1: or if you're sure that the functions are so trivial that they are not eligible for copyright under your country's copyright laws.

When using the Apache 2.0 license, the place for these third party license notices is the NOTICE file. The Apache license has special rules that require everyone to keep the relevant contents of that file intact and to make the file available to all users. This way, your LICENSE file only has to contain the Apache text.

Crediting the original projects doesn't matter. It is of course a very good idea to credit the original projects, and it is required e.g. in an academic context. But for the copyright and licensing aspects, it only matters that you comply with the licenses. So you might want to do both:

  • credit the original project in a docstring
  • fulfil the license obligations by copying the BSD license notice into the NOTICE file
  • So a separate file? I've no trouble with this - thought my LICENSE would be a massive stack of other licenses. I couldn't find much material on how to make one, though - is this a good template? Nov 22, 2020 at 18:17
  • @OverLordGoldDragon That template is way more thorough than needed. As long as it's clear what each license applies to, anything is fine. The third party notices in the Python license can also be a good example.
    – amon
    Nov 22, 2020 at 18:36
  • 1
    @OverLordGoldDragon Your NOTICE file is much more thorough than required. Very good! Two observations: (1) Your project doesn't have a license yet – add a LICENSE file and update your README and the setup.py. (2) In your files, it is not always obvious whether a function was copied. Instead of providing a reference in the docstring, it could make sense to explicitly state that the code was taken from some source.
    – amon
    Nov 22, 2020 at 21:51
  • 1
    @OverLordGoldDragon No, I was only suggesting a short comment like “this function was copied Synchrosqueezing”. When I see references, I interpret those as “read this to learn more about this technique”, not “I copied stuff from there”. But all of this is gold plating, you're clearly already satisfying the BSD license and adhering to academic customs.
    – amon
    Nov 22, 2020 at 22:00
  • 1
    @OverLordGoldDragon The Apache 2 license DOES NOT require people to track changes, only to mention if a copy they are passing on was modified from the original they received. For code in git repositories this is already quite clear from context. This is more relevant for pre-compiled programs, and helps end users understand if their binary is based on the open-source code or has other modifications.
    – amon
    Nov 22, 2020 at 22:02

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.