Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Code, text and figures are protected by copyright from the moment they are written. A public repository on GitHub lets anyone read your code, but it does not let them reuse it. Without a license, others have no permission to copy, change or share your work. A license is the statement in which the copyright holder grants those permissions, usually on some conditions. The Open Source Initiative maintains the definition of open source and the list of licenses that meet it.

Permissive and copyleft licenses

Open source licenses fall into two broad classes.

Permissive licenses, such as MIT, BSD and Apache 2.0, let anyone reuse the code for any purpose, including in closed-source and commercial software. The main condition is that copies keep the original copyright notice and license. Apache 2.0 also grants rights to any patents the contributors hold.

Copyleft licenses, such as the GNU GPL, also allow any use, but anyone who distributes a modified version, or a larger program that includes the code, must release it under the same license with its source code. The AGPL extends this condition to software that users reach over a network. The Free Software Foundation explains the idea in What is copyleft?. Weaker copyleft licenses, such as the LGPL and the Mozilla Public License, apply the condition only to the library or file itself.

Permissive licenses maximize reuse. Copyleft licenses ensure that improvements stay open. choosealicense.com, maintained by GitHub, compares the common choices in plain language.

Stating a license

By convention, a project states its license in a plain-text file named LICENSE at the top of the repository. The file holds the full text of the license, with the year and the names of the copyright holders filled in. GitHub recognizes the standard licenses, shows the license on the repository page, and offers a template when you add a license file. Package metadata and individual source files name the license with a short SPDX identifier, such as MIT or GPL-3.0-or-later. Say in the README which license covers what, especially when code and data are licensed differently.

Data and other content

Software licenses are written for code. Text, figures and data usually use a Creative Commons license. CC BY requires credit, CC BY-SA adds a copyleft condition, CC BY-NC forbids commercial use, and CC0 gives up all rights. This course website, for example, uses MIT for its code and CC BY for its text.

The data from our modules show the range:

Key considerations

This page is a general introduction, not legal advice.