Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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.

share|improve this question

closed as off-topic by jmoreno, Bart van Ingen Schenau, gnat, World Engineer Apr 8 at 0:18

  • This question does not appear to be about software development within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

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 1 at 18:34
    
Isn't this a legal or a licensing question? –  Elliott Frisch Apr 1 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 1 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 1 at 18:57
3  
This question appears to be off-topic because it is seeking legal advice. –  jmoreno Apr 1 at 19:10

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
    
That makes sense. Do you know any project giving attribution to 3rd party code? –  Danny Navarro Apr 4 at 15:39
1  
@DannyNavarro - sure; go take a look at the Android Project. Have a look at one of my other answers. programmers.stackexchange.com/a/234037/53019 –  GlenH7 Apr 4 at 15:42

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