27

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?

Zizouz212
  • 6,449
  • 4
  • 36
  • 75
Abhi Beckert
  • 2,899
  • 1
  • 14
  • 24
  • 5
    Note: I asked this 4 years ago on SO with good results but it was closed a few weeks ago as off topic. http://stackoverflow.com/questions/6052517/open-source-license-without-attribution – Abhi Beckert Jul 06 '15 at 21:39
  • 4
    It's most definitely on topic here. – trichoplax is on Codidact now Jul 06 '15 at 21:44
  • 1
    What do you expect from the license, i.e., which freedoms/restrictions do you want? Copyleft? Attribution? – unor Jul 06 '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 06 '15 at 21:48
  • 1
    Related question: http://opensource.stackexchange.com/questions/504/can-i-override-a-licensing-policy – kdopen Jul 06 '15 at 21:54

4 Answers4

13

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.

unor
  • 5,620
  • 24
  • 55
  • 1
    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 06 '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 06 '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 06 '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 06 '15 at 23:14
  • @Mnementh: If you use "Open Source license" in OSI’s sense, then no, a license is only an Open Source license if it’s approved by the OSI (which makes sense, as deciding if a license complies is not always easy and opinions might differ; that’s why there is an approvement process in the first place). Of course there might be other definitions of "Open Source", but then it should be pointed out which one is meant (personally, I don’t think other definitions are useful, as it becomes subjective). – unor Jul 06 '15 at 23:24
  • "Open source licenses are licenses that comply with the Open Source Definition" http://opensource.org/licenses – Mnementh Jul 06 '15 at 23:27
  • @Mnementh: "Is an Open Source license, even if it is not listed on your web site? In general, no." http://opensource.org/faq#unlisted-licenses – unor Jul 06 '15 at 23:28
  • Approval tests for more than compliance to the definition, for instance "Discourage vanity and duplicative Licenses". – Mnementh Jul 06 '15 at 23:29
  • But actually we shouldn't fight about this, I heard there is a site, where you can ask such questions to get a decision from the community. ;-) – Mnementh Jul 06 '15 at 23:30
  • 1
    @unor: http://opensource.stackexchange.com/q/895/55 – Mnementh Jul 06 '15 at 23:35
  • @unor one of OSI's requirements is that a license be used by a "significant" portion of open source developers. CC0 is an open source license and passes all of OSI's other requirements, but it's too young to be widely adopted yet. They almost certainly will list it some day, since usage is growing quickly. – Abhi Beckert Jul 12 '15 at 22:29
  • CC0 really isn't a license, it's a "public domain dedication" designed to allow anyone to use the work for anything. By contrast, an open source or free software license includes copyright and/or copyleft restrictions designed to protect users' rights. – jkdev Oct 15 '15 at 08:13
  • @jkdev: Right, thanks. I’ve updated the wording in my answer. I guess that should work? – unor Oct 15 '15 at 14:29
10

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.

Zizouz212
  • 6,449
  • 4
  • 36
  • 75
  • 4
    See also WTFPL, which puts it a bit more bluntly. – domen Jul 07 '15 at 08:13
  • 2
    @domen I was going to suggest that actually. It's an... interesting license – Zizouz212 Jul 07 '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 08:22
  • 1
    @jkdev Ah, but you are wrong. The reason CC0 is not approved is due to the fact that software patent rights are not given up. This is why I recommend the Unlicense, an not necessarily CC0. Fundamentally, both licenses due the exact same thing: dedicate code to the public domain under the full extent they can under the law. – Zizouz212 Oct 16 '15 at 01:39
  • Good point. I shouldn't have said CC0 removes all restrictions. – jkdev Oct 16 '15 at 03:29
  • 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
  • 1
    Its worth using a well know permissive license, so everyone who uses can see its something they may have heard of before without having to read-up on yet another license. – ideasman42 Oct 20 '15 at 04:02
3

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 Public 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.

jkdev
  • 395
  • 3
  • 9
  • 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 07: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 01: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 05: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. – vhs Jul 03 '17 at 06: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
1

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.

vonbrand
  • 5,267
  • 1
  • 13
  • 30