List of exercises
Full list
This is a list of all exercises and solutions in this lesson, mainly as a reference for helpers and instructors. This list is automatically generated from all of the other pages in the lesson. Any single teaching event will probably cover only a subset of these, depending on their interests.
Software licensing focusing on open source
Limitations and context of this lesson
This lesson is designed as practical educational material for researchers and research software engineers, not formal legal advice
Regional Focus: Guidance is grounded in EU statutory directives, European institutional frameworks and developers based in Europe with a global focus.
Institutional Context: Employment contracts, grant agreements, and university policies heavily influence software ownership and licensing choices.
This lesson covers only the general principles of open-source reuse, copyright scope, and software adaptation.
If you need formal guidance references below and legal experts, especially if you have legal services at your host institute, could be of help:
Scenario 2: Implementing mathematical models with copyleft obligations
You developed a custom mathematical solver implementing algorithms from academic literature. You want to ensure that any downstream improvements, extensions, or modifications made by others remain open-source and are shared back with the scientific community.
Licensing Goal: You want to enforce reciprocity (share-alike), preventing third parties from incorporating your algorithm into proprietary, closed-source software without sharing their modifications.
Legal Reality: Mathematical concepts and formulas themselves are not copyrightable, but your specific code implementation is fully protected by copyright. Applying a copyleft license legally binds anyone who distributes modified versions of your implementation to release their source code under matching reciprocal terms.
JLA Selection Strategy: To enforce reciprocal sharing, you must mandate that downstream distributors disclose their modified source code (
Disclose source) and license their derivative works under matching terms (Copyleft/Share a.).
Solution
What to select in the JLA interface:
Can Column: Select
Distribute,Modify/merge, andCommercial useMust Column: Select
Incl. Copyright,Disclose source, andCopyleft/Share a.Support Column: Select
OSI approved
Example JLA Matches:
EUPL-1.2,GPL-3.0,AGPL-3.0Copyleft Mechanics (EUPL vs. GPL Nuance):
GPL-3.0is the standard global copyleft license, butEUPL-1.2is specifically tailored for European institutions. EUPL-1.2 is officially published in 23 EU language versions (each with equal legal validity), includes built-in compatibility clauses with GPL, and explicitly defaults to EU Member State jurisdiction and courts.Downstream Obligations: Anyone who distributes your code or a modified version of it must provide complete access to the corresponding source code under the same copyleft license and preserve your original copyright notices.
Allowed Inbound Snippets: You can freely embed code snippets licensed under permissive terms (e.g., MIT, Apache-2.0, BSD) or public domain waivers (CC0). You may also embed snippets from compatible copyleft code (e.g., EUPL, GPL). However, you cannot embed closed-source or proprietary code snippets.
In-File Identification (SPDX): Apply standard machine-readable SPDX identifier comments directly at the top of your scripts:
# SPDX-License-Identifier: EUPL-1.2
# Copyright (c) 2026 Author Name <author@institute.eu>
import numpy as np
Scenario 5: Linking against a GPL-licensed library
You are developing an software application that imports or links against an external software library licensed under GPL-3.0 (e.g., importing a GPL Python package or linking a C/C++ static/shared library).
Licensing Goal: Ensure legal compliance while using copyleft libraries as core dependencies in your software project.
Legal Reality: Under mainstream copyright interpretation and the text of GPL-3.0, linking your code directly against a GPL library (whether statically or dynamically) creates a combined work. Consequently, the copyleft obligations of the external library extend to your entire repository.
JLA Selection Strategy: Because linking to a GPL library requires your distributed project to be released under matching reciprocal terms, you must configure JLA to mandate source code disclosure (
Disclose source) and reciprocal licensing (Copyleft/Share a.).
Solution
What to select in the JLA interface:
Can Column: Select
Distribute,Modify/merge, andCommercial useMust Column: Select
Incl. Copyright,Disclose source, andCopyleft/Share a.Support Column: Select
OSI approved
Example JLA Matches:
GPL-3.0,EUPL-1.2Linking Boundaries & License Selection (Legal Nuance):
Why GPL forces copyleft: Linking against a standard
GPL-3.0library extends copyleft to your entire project. Your repository must adopt a compatible copyleft license (GPL-3.0orEUPL-1.2, which explicitly lists GPL-3.0 in its compatibility appendix).Why LGPL or EUPL-1.2 libraries allow permissive licenses: If the external library is licensed under
LGPL(which includes an explicit linking exception) orEUPL-1.2(where European Commission guidance takes the position that dynamically linking an EUPL work through its API does not by itself create a derivative work), copyleft does not extend to your application. In these dynamic linking scenarios, your own project can stay permissively licensed (e.g., MIT, Apache-2.0, BSD). However, note that this EUPL stance reflects Commission guidance rather than settled CJEU case law, and static linking or direct code incorporation continues to trigger EUPL copyleft obligations.
Downstream Obligations: Downstream users who receive or run your application must receive full access to your source code under
GPL-3.0(orEUPL-1.2), along with all upstream copyright notices and build scripts required to recompile the project.Allowed Inbound Code & Dependencies: Your project can import or include other permissively licensed packages (MIT, BSD, Apache-2.0) and public domain waivers (CC0). However, all code linked together in the final executable or runtime environment must satisfy GPL compatibility.
In-File Identification (SPDX): Apply standard machine-readable SPDX identifier comments directly at the top of your main scripts:
# SPDX-License-Identifier: GPL-3.0-or-later
# Copyright (c) 2026 Author Name <author@institute.eu>
import gpl_licensed_solver # External GPL dependency forces GPL/EUPL compliance
def solve_system(data):
return gpl_licensed_solver.compute(data)
Scenario 7: Distributing pre-built container images
You compiled and published a pre-built container image (e.g., pushing a compiled Docker image to Docker Hub, GitHub Container Registry, or an institutional registry) containing an OS layer, runtime binaries, dependencies, and your application code.
Licensing Goal: Safely distribute compiled container images without violating the license terms of any software layer or binary included inside the image.
Legal Reality: A compiled container image is a multi-license aggregate bundle. Distributing pre-built binaries triggers source-code distribution obligations for any copyleft software (e.g., Linux base packages, coreutils, GPL libraries) pre-installed inside the image layers.
JLA Selection Strategy: Because a container image combines multiple distinct software components, JLA is used to evaluate constituent component obligations. When distributing compiled binaries containing copyleft layers, source disclosure requirements (
Disclose source) must be fulfilled for those specific layers.
Solution
What to select in the JLA interface:
Can Column: Select
DistributeandCommercial useMust Column: Select
Incl. CopyrightandDisclose sourceSupport Column: Select
OSI approved
Example JLA Matches:
Multi-License Bundle(Governed by constituent package terms)Multi-License Aggregation Nuance: Applying a permissive license (like MIT) to your application code inside the container does not override or erase the GPL/LGPL obligations of base system packages installed in
/usr/libor/usr/bin. Distributing the built image binary makes you a distributor of all installed packages.Downstream Obligations: You must ensure that downstream users can obtain the source code for copyleft components shipped inside the image, typically by publishing the
Dockerfileand build steps used to generate the image from public upstream sources.Allowed Inbound Packages: Before publishing an image binary, run automated compliance scanning tools (e.g., Syft, Trivy) to generate a Software Bill of Materials (SBOM) and verify that no non-redistributable or proprietary software is packaged inside.
In-File Identification (Metadata Annotations): Document the multi-license nature of the aggregate bundle using standard OCI (Open Container Initiative) image labels inside your Dockerfile:
# SPDX-License-Identifier: MIT
# Copyright (c) 2026 Author Name <author@institute.eu>
FROM ubuntu:24.04
LABEL org.opencontainers.image.authors="author@institute.eu"
# OCI Standard Image Annotations for Docker Hub Compliance
LABEL org.opencontainers.image.title="My Research Pipeline"
LABEL org.opencontainers.image.licenses="MIT AND GPL-3.0-or-later"
LABEL org.opencontainers.image.vendor="My Institute Name"
LABEL org.opencontainers.image.description="Includes Ubuntu 24.04 base layers (GPL/LGPL) and custom solver (MIT)"
COPY solver.py /app/solver.py
Scenario 8: AI-assisted code generation
You used AI tools (e.g., GitHub Copilot, ChatGPT, Claude) to write functions, unit tests, or documentation for your research software repository.
Licensing Goal: Retain clear ownership and apply a permissive license (
MITorApache-2.0) to your repository without incurring hidden copyright infringement or copyleft obligations from code embedded during model training.Legal Reality: Unmodified AI-generated outputs lack human authorship and are generally not eligible for copyright protection under current EU and international legal standards. However, if an LLM reproduces a substantial copyrighted code snippet verbatim from its training data (memorization), that output snippet retains its original copyright and license obligations.
JLA Selection Strategy: To ensure maximum adoption and academic reuse for your overall codebase, require citation credit (
Incl. Copyright) while avoiding share-alike constraints (leavingCopyleft/Share a.unselected), supported by automated compliance checks.
Solution
What to select in the JLA interface:
Can Column: Select
Distribute,Modify/merge, andCommercial useMust Column: Select
Incl. CopyrightSupport Column: Select
OSI approved
Example JLA Matches:
MIT,Apache-2.0,BSD-3-ClauseAI Code Generation & Verification Nuance: Because non-human AI output cannot hold copyright, your copyright applies to the overall project structure, human-written logic, and creative choices. To protect your repository against accidental copyright infringement or copyleft contamination from AI memorization, turn on public code matching filters in your AI tools and run automated code-similarity scanners before releasing your repository.
Downstream Obligations: Downstream users must preserve your copyright notice for the repository. They are free to reuse, modify, and integrate your code into commercial or open-source projects.
Allowed Inbound Snippets: You can include permissively licensed code, public domain code (CC0), and AI-generated snippets that have been verified against verbatim training data duplication.
In-File Identification (SPDX): Apply standard machine-readable SPDX identifier comments directly at the top of your scripts:
# SPDX-License-Identifier: MIT
# Copyright (c) 2026 Author Name <author@institute.eu>
def filter_sensor_data(raw_readings: list[float]) -> list[float]:
"""Cleans raw sensor data (written with AI assistance and human review)."""
return [reading for reading in raw_readings if reading > 0.0]
Scenario 9: Packaging AI workflows, datasets, and model weights
You are developing research software that includes source code alongside trained machine learning model weights (.pt, .safetensors) and benchmark datasets.
Licensing Goal: Apply a clear dual-licensing strategy that makes both the software source code and the non-code assets (data, weights) open and reusable under appropriate legal frameworks.
Legal Reality: Standard open-source software licenses (MIT, GPL) are written specifically for source code and are legally ill-suited for datasets or neural network parameters. Under EU legal frameworks, datasets and model weights are governed by database rights (sui generis database protection) rather than traditional code copyright.
JLA Selection Strategy: Use JLA to select an OSI-approved open-source license for the executable code component (
Incl. Copyrightselected), while using Creative Commons licenses (e.g.,CC-BY-4.0orCC0) for the dataset and weight files.
Solution
What to select in the JLA interface:
Can Column: Select
Distribute,Modify/merge, andCommercial useMust Column: Select
Incl. CopyrightSupport Column: Select
OSI approved
Example JLA Matches:
MIT,Apache-2.0(for the code component)Code vs. Data/Weights & OpenRAIL Nuance: Never apply software licenses like GPL or MIT to raw datasets or model weights. Use CC-BY-4.0 or CC0 for non-code assets. Additionally, behavioral licenses (such as OpenRAIL) impose usage restrictions (e.g., prohibiting specific harmful uses), which means they do not qualify as OSI-approved open-source software and cannot be filtered via standard JLA open-source queries.
Downstream Obligations: Downstream users must cite your repository for the code (under your chosen software license) and give credit for the model weights and data under the corresponding Creative Commons license.
Allowed Inbound Assets: You may combine permissively licensed python code with CC-BY-4.0 datasets or open-weight models, provided the attribution files clearly separate code licenses from data/weight licenses.
In-File Identification (SPDX / Dual-Licensing Structure): Document the dual-licensing scheme in your root repository structure and script headers:
# SPDX-License-Identifier: MIT
# Copyright (c) 2026 Author Name <author@institute.eu>
#
# Note: Source code is licensed under MIT.
# Model weights in /models/ and datasets in /data/ are licensed under CC-BY-4.0.
import torch
def load_pipeline():
model = torch.load("models/climate_weights.safetensors")
return model
Software citation
Discussion (Citation-1): Explain how you currently cite software
Do you cite software that you use? How?
If I wanted to cite your code/scripts, what would I need to do?
OLD Software licensing
Licensing-1: What constitutes derivative work?
This question 5 below can be used as a starting point and copied to the collaborative document or form input for an online poll:
## Question 5: Which of these are derivative works?
**Choose many**. Vote by adding an `o` character:
- A. Download some code from a website and add on to it
- votes:
- B. Download some code and use one of the functions in your code
- votes:
- C. Changing code you got from somewhere
- votes:
- D. Extending code you got from somewhere
- votes:
- E. Completely rewriting code you got from somewhere
- votes:
- F. Rewriting code to a different programming language
- votes:
- G. Linking to libraries (static or dynamic), plug-ins, and drivers
- votes:
- H. Clean room design (somebody explains you the code but you have never seen it)
- votes:
- I. You read a paper, understand algorithm, write own code
- votes:
Solution
Derivative work: A-F
Not derivative work: G-I
E and F: This depends on how you do it, see clean room design.
Licensing-2: Consider some common licensing situations
What is the StackOverflow license for code you copy and paste?
A journal requests that you release your software during publication. You have copied a portion of the code from another package, which you have forgotten. Can you satisfy the journal’s request?
You want to fix a bug in a project someone else has released, but there is no license. What risks are there?
How would you ask someone to add a license?
You incorporate MIT, GPL, and BSD3 licensed code into your project. What possible licenses can you pick for your project?
You do the same as above but add in another license that looks strong copyleft. What possible licenses can you use now?
Do licenses apply if you don’t distribute your code? Why or why not?
Which licenses are most/least attractive for companies with proprietary software?
Solution
As indicated here, all publicly accessible user contributions are licensed under Creative Commons Attribution-ShareAlike license. See Stackoverflow Terms of service for more detailed information.
“Standard” licensing rules apply. So in this case, you would need to remove the portion of code you have copied from another package before being able to release your software.
By default you are no authorized to use the content of a repository when there is no license. And derivative work is also not possible by default. Other risks: it may not be clear whether you can use and distribute (publish) the bugfixed code. For the repo owners it may not be clear whether they can use and distributed the bugfixed code. However, the authors may have forgotten to add a license so we suggest you to contact the authors (e.g. make an issue) and ask whether they are willing to add a license.
As mentionned in 3., the easiest is to fill an issue and explain the reasons why you would like to use this software (or update it).
Combining software with different licenses can be tricky and it is important to understand compatibilities (or lack of compatibilities) of the various licenses. GPL license is the most protective (BSD and MIT are quite permissive) so for the resulting combined software you could use a GPL license. However, re-licensing may not be necessary.
Derivative work would need to be shared under this strong copyleft license (e.g. AGPL or GPL), unless the components are only plugins or libraries.
If you keep your code for yourself, you may think you do not need a license. However, remember that in most companies/universities, your employer is “owning” your work and when you leave you may not be allowed to “distribute your code to your future self”. So the best is always to add a license!
The least attractive licenses for companies with proprietary software are licenses where you would need to keep an open license when creating derivative work. For instance GPL and and AGPL. The most attractive licenses are permissive licenses where they can reuse, modify and relicense with no conditions. For instance MIT, BSD and Apache License.
Social coding
In social-coding.md:
Social-1: Think about if and how you share
Did you ever share your code? If yes, what motivated you? Come up with reasons for sharing your scripts/code/data.
Also think about reasons for not sharing.
In social-coding.md:
Social-2: Discussion about “You aren’t required to support anyone”
Have you experienced an implicit expectation of support?
Supporting all requests can lead to overworking and mental health issues.
Not supporting requests can also induce guilt.
Most projects are maintained by 1 or 2 persons.
Most projects cannot retain contributors for a longer time. Interests change. “Casual contributors are like tourists visiting NYC for a weekend” (Nadia Asparouhova, book below).
If you maintain all projects that you start forever, at some point it may be difficult to start new projects.
What are your experiences? Do you agree with the above thoughts?
Book recommendation: Nadia Asparouhova (formerly Nadia Eghbal): “Working in Public: The Making and Maintenance of Open Source Software (Stripe Press)”