Agent Wranglers

OSS-1Required

Choose an OSI-approved licence before the first release

Before the first public release, put the full text of one OSI-approved licence in a LICENSE file at the root of the repository. Ship the same text inside every release.

How to do it

Code with no licence is all rights reserved, so nobody may legally use, change or share it, however public the repository is. Pick from the OSI list, which only holds licences that meet the Open Source Definition. A permissive licence, such as MIT or Apache-2.0, lets anyone reuse the code in closed products. A copyleft licence, such as GPL-3.0-or-later or AGPL-3.0-only, makes changed copies stay open. Apache-2.0 also grants a patent licence. Write the choice down as a decision record, as Keep decision records with a status says. People who take your code check the licence the way Keep an open licence or a way out describes.

Examples

JavaScript example

import { readFile } from 'node:fs/promises';

const list = await (await fetch('https://spdx.org/licenses/licenses.json')).json();
const pkg = JSON.parse(await readFile('package.json', 'utf8'));
const entry = list.licenses.find(licence => licence.licenseId === pkg.license);
if (!entry?.isOsiApproved) throw new Error(`${pkg.license} is not an OSI-approved SPDX identifier`);

Python example

import json, tomllib, urllib.request

with urllib.request.urlopen("https://spdx.org/licenses/licenses.json") as response:
    licences = {entry["licenseId"]: entry for entry in json.load(response)["licenses"]}
declared = tomllib.load(open("pyproject.toml", "rb"))["project"]["license"]
assert licences.get(declared, {}).get("isOsiApproved"), f"{declared} is not OSI approved"

How to check

The repository root has a LICENSE or LICENSE.txt file. A licence detector run on it reports one SPDX identifier, and that identifier is marked OSI approved in the SPDX licence list. The latest release archive contains the same file.

Sources

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/open-source/licences-and-copyright/osi-approved-licence">Agent Wranglers open source maintenance playbook</a>. In code you write, add a comment next to it with the same link.