I share small snippets of code with friends, and would like to post them online for others to use.

I'm not sure of the best license?

I was thinking MIT, but it includes this clause:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

These code snippets are not very big, not enough to justify adding an entire license screen. And there is no "read me" or "license" text file distributed along with a mobile app.

I'm not going to change the user interface of my app, just so I can turn three lines of ugly code into one line of clean code.

Is there an open source license that does not require the license to be bundled with binary copies of the app?

Or perhaps I should use MIT and delete that one clause?

  • 5
    Note: I asked this 4 years ago on SO with good results but it was closed a few weeks ago as off topic. stackoverflow.com/questions/6052517/… – Abhi Beckert Jul 6 '15 at 21:39
  • 3
    It's most definitely on topic here. – trichoplax Jul 6 '15 at 21:44
  • 1
    What do you expect from the license, i.e., which freedoms/restrictions do you want? Copyleft? Attribution? – unor Jul 6 '15 at 21:46
  • 3
    @unor I expect my friends and other people to be able to use the code without worrying that I will sue them later for copyright infringement. No restrictions. – Abhi Beckert Jul 6 '15 at 21:48
  • 1
    Related question: opensource.stackexchange.com/questions/504/… – kdopen Jul 6 '15 at 21:54
up vote 7 down vote accepted

It looks like you want a permissive license. Perhaps, you could use the unlicense?

From their site:

The Unlicense is a template for disclaiming copyright monopoly interest in software you've written; in other words, it is a template for dedicating your software to the public domain. It combines a copyright waiver patterned after the very successful public domain SQLite project with the no-warranty statement from the widely-used MIT/X11 license.

As such, you would be able to license your code, placing little to no restrictions on it.

  • 4
    See also WTFPL, which puts it a bit more bluntly. – domen Jul 7 '15 at 8:13
  • 2
    @domen I was going to suggest that actually. It's an... interesting license – Zizouz212 Jul 7 '15 at 12:32
  • To remove all restrictions, you could use the CC0 public domain dedication instead of a license. However, not everyone recommends CC0 for use in open source software. (See unor's answer). – jkdev Oct 15 '15 at 8:22
  • 2
    @jkdev and CC0 is also a license :) – Zizouz212 Oct 16 '15 at 11:23
  • 1
    Technically it's a hybrid -- it contains a permissive license as a fallback, in case the software cannot legally be donated to the public domain. (The Unlicense is like that as well.) Copyright is automatic in the U.S. and many other jurisdictions, and whether it can be voluntarily removed is often unclear or downright impossible. – jkdev Oct 16 '15 at 17:43

It seems that you don’t need a typical FLOSS license at all.

If you want to let everyone use the code snippets and allow them to do whatever they want to do with them (which includes publishing these snippets themselves without explicitly granting others the freedom to use these), without having to attribute you and without having to reference a license, then you could release the works into the public domain.

As this is not possible in all jurisdictions, there are legal tools that try to "simulate" the public domain to the greatest extent allowed by the respective laws.

A popular one is CC0 1.0 (it’s approved by the FSF, but not approved by the OSI).

You would just have to include something like this somewhere, e.g., in your site’s footer or your Stack Overflow profile:

To the extent possible under law, I have dedicated all copyright and related and neighboring rights to code snippets (posted on http://example.com/) to the public domain worldwide. See CC0 1.0.

(Here’s what CC and the FSF recommend to write; it’s, for example, recommended to mention your jurisdiction. CC offers a tool that outputs a possible snippet.)

Now everyone can use the snippets in any way (but it doesn’t affect your possible trademark or patent rights), without having to reference CC0 1.0 and without having to attribute you.

  • I feel like I should be clear here, but Creative Commons licenses aren't intended for software. Also, they're not OSI approved, for the other side of this – Zizouz212 Jul 6 '15 at 22:14
  • 1
    @Zizouz212: Neither Creative Commons itself agrees with that (CC says that CC0 is suitable for software), nor the FSF (CC0 is a GPL-compatible Free Software license). ··· And yes, CC0 is not approved by the OSI (see their FAQ about it), so it’s not an Open Source license. – unor Jul 6 '15 at 22:22
  • @Zizouz212 CC0 is definitely intended for software. It can and should be used where appropriate. Other creative commons licenses should not be used. The only confusion comes from people assuming that "creative commons" is a license when it's actually a group of several licenses. CC0 hasn't been formally approved by OSI as an open source license but it does meet all of their requirements and probably should be approved by them, no doubt they will get around to it one day. – Abhi Beckert Jul 6 '15 at 22:24
  • @unor: I don't think approval of the OSI is strictly needed for an open source license, complying with the definition is enough. – Mnementh Jul 6 '15 at 23:14
  • 1
    @unor: opensource.stackexchange.com/q/895/55 – Mnementh Jul 6 '15 at 23:35

Another contender: the Zero Clause BSD License (0BSD), also called the Free Public License 1.0.0.

It's similar to the ISC License, except that there's no requirement to redistribute the license's text.

Here's the original 0BSD license, as used for toybox:

Copyright (C) 2006 by Rob Landley

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

0BSD / Free Software License 1.0.0 is approved by the Open Source Initiative, but is not mentioned by the Free Software Foundation.

Hat Tip: This answer to a related question, specifically dashesy's comment mentioning 0BSD.

  • Calling it "0BSD" or "Zero-Clause BSD License" is somewhat confusing, though. The ISC License has been used for OpenBSD and sometimes goes by the name "OpenBSD License," but it isn't actually related to either the original or modified BSD License. – jkdev Oct 16 '15 at 7:46
  • While I'm not discrediting this license (ISC), I want to raise up the issue of license proliferation here. This is arguably a copy of the MIT license, and the issue of having multiple, incredibly similar licenses only adds to confusions when people choose licenses for their products. It seems that you recommend the '0BSD' license, which you note is not open source. – Zizouz212 Oct 19 '15 at 1:24
  • OSI and FSF don't list 0BSD as open source. That might change if it becomes widespread, like if bloggers apply it to all their code snippets... Or, does an "open source" license by definition require itself to be redistributed? (Maybe that's another question topic.) And you're right about open source / public domain license proliferation. If you go by the SPDX License List there are over 300 (including 0BSD, which was added earlier this year). – jkdev Oct 19 '15 at 5:54
  • This is a nice, terse license. Thanks for sharing it here as it feels very appropriate for code snippets where modifications should not lead to license proliferation as a result of the license being able to be removed assuming I read the rationale correctly. – Josh Habdas Jul 3 '17 at 6:10
  • 1
    Update: 0BSD, also called the "Free Public License 1.0.0," has been added to the list of licenses approved by the OSI. – jkdev Sep 24 '17 at 19:39

You talk about "snippets", thus presumably minimal stretches of code. Whatever you stipulate, they might fall under minimal pieces of the work under consideration, too little to be considered a "substantial part" triggering copyright. Besides, short snippets probably describe a way of doing something that can't be done in any other way, thus non-copyrightable to start with.

I am not a lawyer, and don't pretend to be one on random web sites either. To make sure, a real lawyer retained by you would have to review much more of the case.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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