10

I frequently find myself wanting to use some small function from another library but end up not doing because it's not worth pulling another dependency.

Considering BSD/MIT licenses, if I just copy/paste a function from another package, what would be the legal requirement when licensing my code? Also, as matter of netiquette, what would be the preferable way to give credit to the original author?

I understand this depends on the specific circumstances of each situation. The safe way would be to always ask the upstream author what does he want, but, sometimes, this happens so frequently that having a a default proposition for the upstream author can make the interaction smoother.

Danny Navarro
  • 211
  • 2
  • 7
  • 1
    The author has already stated his intentions by choosing a license for his code. Just conform to the requirements of the license. – Robert Harvey Apr 01 '14 at 18:34
  • Isn't this a [legal](http://area51.stackexchange.com/proposals/52687/legal-doctrine-policy-practice-and-other-law-related-topics) or a [licensing](http://area51.stackexchange.com/proposals/58715/open-source-licensing) question? – Elliott Frisch Apr 01 '14 at 18:48
  • Sorry if I didn't formulate the question correctly. I have absolutely no clue about licensing or legal aspects of software. Also, when googling about this I couldn't find a straight answer. – Danny Navarro Apr 01 '14 at 18:53
  • 2
    @DannyNavarro "What would be the legal requirement when licensing my code?" is a question for your attorney. Then, worst case, for a judge. – Elliott Frisch Apr 01 '14 at 18:57
  • @ElliottFrisch, I see, so it's more complicated than what I expected. I guess it'll also be different depending on the country. A better question would be "what's the most commonly accepted practice for this scenario?" – Danny Navarro Apr 01 '14 at 19:06
  • It's not necessarily more complicated than what you expect, but nobody wants to be hauled before the bar for giving unlicensed legal advice. If you don't think you understand it, then you need a lawyer. If you think you do understand it -- well, then its up to you to judge the risk vs rewards and decide whether you need a legal opinion from a professional before acting upon your understanding. – jmoreno Apr 01 '14 at 19:09
  • 3
    This question appears to be off-topic because it is seeking legal advice. – jmoreno Apr 01 '14 at 19:10
  • @DannyNavarro I would not expect "Everybody else is doing it" to be adjudicated favorably. – Elliott Frisch Apr 01 '14 at 19:12

1 Answers1

15

You need to follow the terms of the license(s).1

1Honestly, that's it.


For the licenses you cite (BSD, MIT) there is nothing within the license terms that say you must use the entire module. In fact, both of those licenses give you explicit permission to do what you're suggesting.

MIT

including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software

BSD

Redistribution and use in source and binary forms, with or without modification, are permitted ...

So go ahead and take those functions out of those modules that you want in order to avoid creating a dependency upon a whole library.

But what you can't do is fail to attribute the source of the code you used. Both licenses require that you include a copy of the license as well as the copyright notice.

That may mean you need to put a prolog around the modules you copy and provide copyright attribution. Or you may have to modify the license files to explicitly call out what portions of your code were sourced from where. It's going to depend upon your project and the extent of how much you borrowed.

You also said:

The safe way would be to always ask the upstream author what does he want

But that's not quite true. The upstream author has already expressly told you their intent through the license terms that they have released their code under. You only need to contact the upstream author if you want to do something outside of the terms of the license.