I am borrowing and heavily modifying code from an open source repo (let's call this A). However, the code I am borrowing also contains code borrowed from another open source project (let's call this B). Naturally, I would include the license of A into my project, and since A has some code from B, I am assuming that I should include B's license as well.

However, I modified the code borrowed from A in such a way that only one line from B remains (in my project, only the start of the for loop remains). Do I still include B's license?

  • Is the code at the "start of the for loop" that is remaining creative and original, or is it generic like "for (int i = 0; i < 10000; i++)" and that's it?
    – Brandin
    Commented Oct 17, 2019 at 21:15
  • @Brandin, this is it: for line in content.splitlines():. Commented Oct 18, 2019 at 1:20
  • 1
    If that is the only line you "copied" then I would not worry about that all. That line of code is completly ordinary Python that anyone could have written. It is not orignial or creative. If you look through Python code written by differnet authors you will probably find the exact same line of code written in lots of places by many different people; it is basically just an ordinary use of the language.
    – Brandin
    Commented Oct 18, 2019 at 5:50
  • 2
    @Brandin had the OP copied one line of B's codebase while creating a new work, I would likely agree with you, but that is not the scenario. Instead the OP has made a work which is by his own admission a derivative of A, which in turn was known to be a derivative of B. The question is whether the OP's work is a derivative of B; not whether a new, similar work created ab initio would be such a derivative. The same outcome reached by different paths may have very different treatments in law; method is important.
    – MadHatter
    Commented Oct 18, 2019 at 6:59

1 Answer 1


You have tripped over an old conundrum known as the Ship of Theseus, or sometimes as the Grandfather's Axe paradox. If you remove all traces of B's work on a project through a gradual process of refactoring and replacement, is the project now a derivative work of B's? Or as Wikipedia puts it:

texts and computer programs may be edited gradually but so heavily that none of the original remains, posing the legal question of whether the owners of the original have any claim on the result

As I have written elsewhere, I'm not aware of any jurisprudence to guide us on the matter, so it comes down to opinions. Personally, I think a strong argument can be made that even a completely-refactored work is a derivative, unless special care is taken to avoid this.

But we need not argue that here as fortunately, in your case, one line from B remains. That seems to me to be enough to make it very clear that it is a derivative work, so yes, include B's copyright statement, and honour B's licence requirements, including those regarding the licence text.

  • Thanks! I agree that a completely refactored work may be considered derivative since the refactored code is still considered based on the original work. Commented Oct 17, 2019 at 12:23
  • 2
    "Based on" is not enough. For example in your school days you may have had the assignment to read literature and then write a book report on that story. Clearly, the book report you write should be 'based on' the story that you read. But that does not mean that your book report is a 'derivative work' of the literature you read. Nor do you need permission from the author of that book in order to publish your book report. So really this is not so easily summarized or decided.
    – Brandin
    Commented Oct 17, 2019 at 21:20
  • @Brandin, ah. So, for a work to be considered to be derivative, we must consider how a potentially derivative work is based on an original work. Right? Commented Oct 18, 2019 at 1:30
  • 2
    Please don't have this discussion here. Sean, if you want to know more about what constitutes a derivative in copyright law, feel free to ask that question, though this may not be the best SE site on which to ask it.
    – MadHatter
    Commented Oct 18, 2019 at 4:56
  • @MadHatter, okay. Noted. Nevertheless, thanks! Commented Oct 18, 2019 at 6:33

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.