Introduce component-based licensing: Serena GPL-3.0-or-later, SolidLSP MIT

The repository is licensed per component. SolidLSP (src/solidlsp,
test/solidlsp, test/resources) remains MIT-licensed and independently
reusable; the Serena application (src/serena, src/interprompt, scripts,
test/serena, docs) is licensed under GPL-3.0-or-later starting with the v2
licensing transition. The change is not retroactive: all releases and
commits up to v1.7.0 / 74c38a65 (tag mit-final) remain available under MIT.

Since MIT is GPL-compatible, a distribution combining both (such as the
serena-agent package) is as a whole subject to GPL-3.0-or-later, while the
SolidLSP files themselves stay MIT and can be extracted and used separately
under MIT terms. The distribution metadata therefore declares
GPL-3.0-or-later, with both license texts shipped alongside it.

Serena originally began under the GPL (v2) and was switched to MIT in
May 2025 following community requests. We consider that change a mistake;
the substantial changes in v2 make this the appropriate time to revert it.
We want the best version of Serena to remain free.

Changes:
* LICENSE is now the licensing overview; canonical license texts live in
  LICENSES/ (MIT.txt is the previous LICENSE verbatim, GPL-3.0-or-later.txt
  is the unmodified FSF text)
* pyproject.toml declares the PEP 639 license expression
  "GPL-3.0-or-later" and bundles LICENSE and LICENSES/* as license files;
  the deprecated MIT classifier is dropped and flake.nix declares gpl3Plus;
  README has per-component license badges and a License section
* SPDX-License-Identifier headers in all Python sources under src/ and
  scripts/, added by the new idempotent scripts/add_spdx_headers.py, which
  gen_prompt_factory.py also uses to keep the header on the generated
  module; existing third-party notices are preserved
* CLA.md: Contributor License Agreement (contributor retains copyright;
  grants a perpetual, irrevocable license including relicensing under any
  terms, incl. proprietary/commercial; patent grant; authority
  representations), to be enforced repository-wide via cla-assistant.io
* CONTRIBUTING.md, PR template and a new docs page explain the licensing
  boundary and the CLA workflow
This commit is contained in:
Dominik Jain authored and Dominik Jain committed 2026-09-14 21:33:18 +02:00
1 parent 9f9db76622
commit 6707cd9b7e
186 files changed
+1331 -24

No files matched your search

+95
View File
@@ -0,0 +1,95 @@
# SPDX-License-Identifier: GPL-3.0-or-later
"""
Adds SPDX-License-Identifier headers to Python source files according to the component
licensing structure documented in LICENSE.
Idempotent: files that already contain an SPDX identifier are left untouched.
Existing copyright notices and module docstrings are never modified; the identifier is
inserted after any shebang/encoding lines and after a leading module docstring (if present).
"""
import ast
import sys
from dataclasses import dataclass
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
SPDX_PREFIX = "# SPDX-License-Identifier:"
@dataclass(frozen=True)
class LicensedTree:
"""A directory tree whose Python files fall under a single license."""
relative_path: str
spdx_id: str
TREES = [
LicensedTree("src/solidlsp", "MIT"),
LicensedTree("src/serena", "GPL-3.0-or-later"),
LicensedTree("src/interprompt", "GPL-3.0-or-later"),
LicensedTree("scripts", "GPL-3.0-or-later"),
]
def _header_end_line(source: str) -> int:
"""
Determines the 0-based line index at which the SPDX line is to be inserted, i.e. after
shebang/encoding lines and after a leading module docstring.
"""
lines = source.splitlines(keepends=True)
idx = 0
while idx < len(lines) and (lines[idx].startswith("#!") or (lines[idx].startswith("#") and "coding" in lines[idx])):
idx += 1
try:
module = ast.parse(source)
except SyntaxError:
return idx
if (
module.body
and isinstance(module.body[0], ast.Expr)
and isinstance(module.body[0].value, ast.Constant)
and isinstance(module.body[0].value.value, str)
):
return max(idx, module.body[0].end_lineno)
return idx
def add_header(path: Path, spdx_id: str) -> bool:
"""Adds the SPDX header to the given file; returns whether the file was modified."""
with path.open(encoding="utf-8", newline="") as f:
source = f.read()
if SPDX_PREFIX in source:
return False
# keep empty files (e.g. package markers) untouched
if not source.strip():
return False
# insert header, keeping the file's newline convention
newline = "\r\n" if "\r\n" in source else "\n"
lines = source.splitlines(keepends=True)
idx = _header_end_line(source)
header = f"{SPDX_PREFIX} {spdx_id}{newline}"
if idx < len(lines) and lines[idx].strip() != "":
header += newline
lines.insert(idx, header)
path.write_text("".join(lines), encoding="utf-8", newline="")
return True
def main() -> None:
modified = 0
for tree in TREES:
for path in sorted((ROOT / tree.relative_path).rglob("*.py")):
if "__pycache__" in path.parts:
continue
if add_header(path, tree.spdx_id):
modified += 1
print(f"{tree.spdx_id:18} {path.relative_to(ROOT)}")
print(f"{modified} file(s) modified", file=sys.stderr)
if __name__ == "__main__":
main()
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: GPL-3.0-or-later
from agno.models.anthropic.claude import Claude
from agno.models.google.gemini import Gemini
from agno.os import AgentOS
+1
View File
@@ -7,6 +7,7 @@ Usage:
This reads all .html files from the `news/` directory and creates
`news/news.json` containing a mapping of news IDs to HTML content strings.
"""
# SPDX-License-Identifier: GPL-3.0-or-later
import json
import os
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: GPL-3.0-or-later
from __future__ import annotations
import logging
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: GPL-3.0-or-later
from serena.cli import top_level
if __name__ == "__main__":
+1
View File
@@ -5,6 +5,7 @@ The script creates a temporary Python file inside this repository, introduces on
shows file and symbol diagnostics, then introduces another warning and verifies that the
second edit reports only the newly introduced warning.
"""
# SPDX-License-Identifier: GPL-3.0-or-later
import json
import shutil
+1
View File
@@ -1,6 +1,7 @@
"""
Demonstrates both defining-symbol tools on the Python test repository.
"""
# SPDX-License-Identifier: GPL-3.0-or-later
import json
import re
+1
View File
@@ -1,6 +1,7 @@
"""
Demonstrates FindImplementationsTool on the Go test repository.
"""
# SPDX-License-Identifier: GPL-3.0-or-later
import json
from pathlib import Path
@@ -5,6 +5,7 @@ printing the full result, then progressively tighter max_answer_chars
to show the successive shortening stages. Both LSP and JetBrains backends
are tested (JB is skipped if no IDE is running).
"""
# SPDX-License-Identifier: GPL-3.0-or-later
import json
from pprint import pprint
+1
View File
@@ -2,6 +2,7 @@
This script demonstrates how to use Serena's tools locally, useful
for testing or development. Here the tools will be operation the serena repo itself.
"""
# SPDX-License-Identifier: GPL-3.0-or-later
import json
from pathlib import Path
+7 -1
View File
@@ -1,9 +1,11 @@
"""
Autogenerates the `prompt_factory.py` module
"""
# SPDX-License-Identifier: GPL-3.0-or-later
from pathlib import Path
from add_spdx_headers import add_header
from sensai.util import logging
from interprompt import autogenerate_prompt_factory_module
@@ -13,11 +15,15 @@ log = logging.getLogger(__name__)
def main():
target_module_path = Path(REPO_ROOT) / "src" / "serena" / "generated" / "generated_prompt_factory.py"
autogenerate_prompt_factory_module(
prompts_dir=PROMPT_TEMPLATES_DIR_INTERNAL,
target_module_path=str(Path(REPO_ROOT) / "src" / "serena" / "generated" / "generated_prompt_factory.py"),
target_module_path=str(target_module_path),
)
# re-add the license header, which the (externally maintained) generator template does not include
add_header(target_module_path, "GPL-3.0-or-later")
if __name__ == "__main__":
logging.run_main(main)
+1
View File
@@ -32,6 +32,7 @@ Usage::
uv run python scripts/live_test_grok.py --skip-unit # skip the pytest smoke run
uv run python scripts/live_test_grok.py --help # all options
"""
# SPDX-License-Identifier: GPL-3.0-or-later
import argparse
import json
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: GPL-3.0-or-later
from serena.cli import top_level
if __name__ == "__main__":
+1
View File
@@ -1,4 +1,5 @@
"""Generates a GraphML file of the memory reference structure for a given project."""
# SPDX-License-Identifier: GPL-3.0-or-later
import argparse
import xml.etree.ElementTree as ET
+1
View File
@@ -1,6 +1,7 @@
"""
Prints the list of supported languages, for use in the project.yml template
"""
# SPDX-License-Identifier: GPL-3.0-or-later
from solidlsp.ls_config import LanguageServerId
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: GPL-3.0-or-later
from serena.config.context_mode import SerenaAgentContext, SerenaAgentMode
if __name__ == "__main__":
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: GPL-3.0-or-later
from serena.agent import ToolRegistry
if __name__ == "__main__":
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: GPL-3.0-or-later
import cProfile
from pathlib import Path
from typing import Literal
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: GPL-3.0-or-later
from sensai.util import logging
from solidlsp.language_servers.eclipse_jdtls import EclipseJDTLS