by Radu Raicea

How open source licenses work and how to add them to your projects

Image credit: GitHub

Recently, there was some exciting news for developers around the world. Facebook changed the license of multiple libraries they develop. They switched from BSD-3+patents to a MIT.

That seems good, but what does it mean? What are the implications of different open source licenses?

This article will give you a quick understanding of the popular licenses. It will also teach you how to apply them to your open source projects on GitHub.

The Authority

The most popular open source licenses have an important aspect in common. The Open Source Initiative (OSI) has approved them.

OSI formed in 1998 with the goal of promoting open source software. It has created the Open Source Definition (OSD) to define what an open source software means.

This is how they describe themselves:

The Open Source Initiative (OSI) is a non-profit corporation with global scope formed to educate about and advocate for the benefits of open source and to build bridges among different constituencies in the open source community.

The Licenses

Most open source licenses include the following statements:

Software can be modified, used commercially, and distributed. Software can be modified and used in private. A license and copyright notice must be included in the software. Software authors provide no warranty with the software and are not liable for anything.

We will go through the most popular licenses, in order from the most restrictive to the most permissive (from a user’s perspective).

GNU General Public License, version 3 (GPLv3)

GPLv3 is one of the most restrictive licenses. It offers high protection for the author of the software.

The source code must be made public whenever a distribution of the software is made.

whenever a distribution of the software is made. Modifications of the software must be released under the same license .

. Changes made to the source code must be documented .

. If patented material was used in the creation of the software, it grants the right for users to use it. If the user sues anyone over the use of the patented material, they lose the right to use the software.

GPLv2 is also very popular. The main difference from GPLv3 is the clause on patent grants.

That clause was added in version 3 to prevent companies from charging users for the use of their patents.

Popular projects using GPLv3 are Bash and GIMP. Linux uses GPLv2.

Ezequiel Foncubierta pointed something important for GPL licenses:

The license of your source code must be compatible with the license of the open source code you are linking to. For instance, if your code is proprietary, you won’t be allowed to use a library under the GPL license. This is where people tends to make more mistakes.

Apache License 2.0

Apache License 2.0 offers more flexibility to the users.

The source code doesn’t need to be public when a distribution of the software is made.

when a distribution of the software is made. Modifications to the software can be release under any license .

. Changes made to the source code must be documented.

be documented. It offers the same patent usage protection as GPLv3.

It explicitly prohibits the use of trademarked names found in the project.

Popular projects using Apache License 2.0 are Android, Apache, and Swift.

Berkeley Software Distribution (BSD)

BSD has two main versions: 2-clause and 3-clause. They both offer more flexibility to the users than the Apache License 2.0.

The source code doesn’t need to be public when a distribution of the software is made.

when a distribution of the software is made. Modifications to the software can be release under any license .

. Changes made to the source code may not be documented.

be documented. It offers no explicit position on patent usage.

The license and copyright notice must be included in the documentation of the compiled version of the source code (as opposed to only in the source code).

of the source code (as opposed to only in the source code). The BSD 3-clause states that the names of the author and contributors can’t be used to promote products derived from the software without permission.

Popular projects using BSD license are Go (3-clause), Pure.css (3-clause), and Sentry (3-clause).

MIT License

MIT is one of the most permissive licenses. It is also the most popular one. It offers very low protection for the author of the software.

The source code doesn’t need to be public when a distribution of the software is made.

when a distribution of the software is made. Modifications to the software can be release under any license .

. Changes made to the source code may not be documented.

be documented. It offers no explicit position on patent usage.

Popular projects using MIT are Angular.js, jQuery, Rails, Bootstrap, and many more.

Facebook’s React.js had a BSD-3+patents license up until September 25th. It combined the BSD-3 license with an extra clause on patents usage.

In a nutshell, if you sue Facebook or any of its subsidiaries, you lose the right to use React (or any other software under the same license).

React is now MIT licensed. You are now able to sue Facebook and still use React. What a relief!

Applying a license to your open source projects

Licensing your projects is easy. You need to add a LICENSE , LICENSE.txt or LICENSE.md in the root directory of your repository.

GitHub makes it even easier:

Open your GitHub repository in a browser. In the root directory, click on Create new file . Name the file “LICENSE”. Click on Choose a license template . Pick one of the licenses (all the ones mentioned in this article are there). Once chosen, click on Review and submit . Commit the file.

In summary…

One of the most restrictive licenses is GPL .

. One of the most permissive licenses is MIT .

. Other popular licenses are Apache License 2.0 and BSD .

and . To apply a license on your GitHub project, you need to create a LICENSE file using GitHub’s license templates.

Check out my explanation of how I used Python to find interesting people to follow on Medium!

For more updates, follow me on Twitter.