i have a question. Can i copy code (500 lines) from an open source python pip library under MIT license, modify the code and add my (100 lines) and then publish it as not open source and charge people money for it? I can add license.txt to my code, and not claim any right for it.

Can i do this?


  • 4
    What does the text of the MIT license say? Was there any part of it in particular you were having trouble understanding? Jun 22 at 4:27
  • Saying "publish it as my own" is a bit misleaing. Based on your description, it seems like you want to integrate the MIT code into a closed source project, and then publish that closed source (binary) without including the source code.
    – Brandin
    Jun 22 at 8:00
  • @Brandin that's kind of how it seemed to me, but I wasn't sure given that it was python. Perhaps the OP could clarify what (s)he plans to ship?
    – MadHatter
    Jun 22 at 8:39
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Jun 22 at 16:16
  • @MadHatter im planning to ship an python program based on a open source library pip lets name it x and normally you do import x and there is just your code and the code from the library is hidden into program files and you just execute them by doing import x but i copied the code that normally executes in program files and i put it in my code it is kinda hard to understand
    – dismaaay
    Jun 23 at 5:33

1 Answer 1


The MIT licence permits you "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" provided that "the above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software".

You wish to modify and then distribute/sell copies of the modified version, which is permitted. The proviso is that you must include the copyright notice of the original rightholder(s), and the text of the MIT licence. Note that there is no requirement that this text be applicable to your customers; only that it must be included. You can, if you like, include it surrounded by (eg) a warning that it is included pursuant to an upstream licence condition but does not itself fully represent the licence of the purchased product.

It is perfectly OK for you to apply a proprietary licence to the code you are shipping, this being code you received under the MIT licence and then modified.

  • What does "a warning that it is included pursuant to an upstream licence condition but does not itself apply to the licence of the purchased product" mean? Can you give an example?
    – Brandin
    Jun 23 at 10:20
  • The language I just used is an example; or did you mean an example from elsewhere?
    – MadHatter
    Jun 23 at 10:33
  • I guess you're saying, basically, that "the MIT license applies to this part (the 500 lines, the 'upstream' code) but not to the whole product itself (the 'downstream' code)." Is it correct? I had to read the sentence a few times in my head. Maybe it's helpful to note that the MIT License's term "Software" with capital S refers to "The Software" as in the 500 lines, or what you are calling the 'upstream' code.
    – Brandin
    Jun 23 at 10:40
  • I'm saying that the distribution of the derivative work in its entirety must be governed by the conditions of the MIT licence and those of any other licence (possibly, a proprietary one) the OP chooses to apply. I explain my position in more detail in this answer. I can find no basis for the idea that one can somehow tease the originally-MIT-licensed content out of the derivative work, and have it magically "snap back" to being MIT-licensed.
    – MadHatter
    Jun 23 at 11: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.