Skip to content

Commit d0cd906

Browse files
committed
feat(licenses): Updated the software dependencies license workflow
1 parent 4fa2488 commit d0cd906

15 files changed

Lines changed: 645 additions & 4 deletions
Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
<!--
2+
SPDX-FileCopyrightText: 2024-2026 Amilcar do Carmo Lucas <amilcar.lucas@iav.de>
3+
4+
SPDX-License-Identifier: GPL-3.0-or-later
5+
-->
6+
7+
# Adding or Updating Software Dependencies
8+
9+
This document describes the full workflow for adding a new dependency or updating an existing one in the
10+
ArduPilot Methodic Configurator project.
11+
It is intended for both human contributors and AI agents.
12+
13+
All steps must be completed in order for the project to remain REUSE-compliant and its dependency
14+
credits to stay accurate and up to date.
15+
16+
## Overview
17+
18+
```text
19+
pyproject.toml → credits/CREDITS.md → credits/update_credits_licenses.py
20+
→ run script to download license files → REUSE.toml
21+
```
22+
23+
---
24+
25+
## Step 1 — Add the dependency to `pyproject.toml`
26+
27+
Add the package to the appropriate section of `pyproject.toml`:
28+
29+
- Runtime dependency → `[project] dependencies`
30+
- Development tooling → `[project.optional-dependencies] dev`
31+
- CI-only → `[project.optional-dependencies] ci_headless_tests`
32+
33+
Pin the exact version (use `==`).
34+
For packages sensitive to the Python runtime version, use environment markers (e.g., `python_version < '3.10'`).
35+
36+
---
37+
38+
## Step 2 — Update `credits/CREDITS.md`
39+
40+
Add a row to the appropriate table in `credits/CREDITS.md`:
41+
42+
- **Direct** runtime or GUI dependencies → "It directly uses:" table
43+
- **Indirect** (transitive) dependencies → "It indirectly uses:" table
44+
45+
Each row must have:
46+
47+
| Column | Content |
48+
|----------|--------------------------------------------------------------|
49+
| Software | Markdown link to project homepage |
50+
| License | Markdown link to the license URL on the project's repository |
51+
52+
The author name (e.g., "by Mark Pointing") must be included in the Software column whenever
53+
it is known and the dependency is from an individual contributor rather than an organisation.
54+
55+
Example row for a direct dependency:
56+
57+
```markdown
58+
| [simpleeval](https://github.com/danthedeckie/simpleeval) | [MIT License](https://github.com/danthedeckie/simpleeval/blob/main/LICENCE) |
59+
```
60+
61+
---
62+
63+
## Step 3 — Update `credits/update_credits_licenses.py`
64+
65+
Add the new package to the correct list in `credits/update_credits_licenses.py`:
66+
67+
- `direct_dependencies` — for packages listed in the direct-use table
68+
- `indirect_dependencies` — for packages listed in the indirect-use table
69+
70+
Each entry is a dict with two keys:
71+
72+
```python
73+
{"name": "<PackageName>", "license_url": "<raw-URL-to-license-file>"}
74+
```
75+
76+
Rules for the URL:
77+
78+
- Use a **raw** URL that serves the plain-text license (e.g., `https://raw.githubusercontent.com/...`)
79+
- The filename at the end of the URL determines the downloaded file's suffix
80+
(e.g., `…/main/LICENCE``<PackageName>-LICENCE`)
81+
- For packages hosted on Mozilla's site (MPL-2.0) provide `https://mozilla.org/MPL/2.0/` and the
82+
download function will use a fixed HTML filename automatically (see `Scrollable_TK_frame`,
83+
`Python_Tkinter_ComboBox`)
84+
85+
---
86+
87+
## Step 4 — Run the download script
88+
89+
Execute the script from the `credits/` directory.
90+
It reads both lists and downloads each license file:
91+
92+
```bash
93+
cd credits
94+
python update_credits_licenses.py
95+
```
96+
97+
The script saves each file as `<PackageName>-<license-filename>` in the current directory.
98+
Check the output log to confirm all downloads succeeded.
99+
Re-run if any fail due to network errors.
100+
101+
---
102+
103+
## Step 5 — Add entries to `REUSE.toml`
104+
105+
For each newly downloaded license file, append an `[[annotations]]` block to `REUSE.toml`
106+
with the correct path, copyright notice, and SPDX license identifier.
107+
108+
### Finding the copyright holder
109+
110+
1. Open the downloaded license file (e.g., `credits/simpleeval-LICENCE`).
111+
2. Look for a line starting with `Copyright` or `©` at the top.
112+
3. If the license file contains no copyright notice, use the project author name from the
113+
corresponding entry in `credits/CREDITS.md` or the package's repository.
114+
115+
### Choosing the SPDX identifier
116+
117+
Use the canonical [SPDX license list](https://spdx.org/licenses/).
118+
Common mappings:
119+
120+
| License text says | SPDX-License-Identifier |
121+
|------------------------------------|-------------------------|
122+
| MIT License | `MIT` |
123+
| Apache License, Version 2.0 | `Apache-2.0` |
124+
| BSD 2-Clause | `BSD-2-Clause` |
125+
| BSD 3-Clause | `BSD-3-Clause` |
126+
| Mozilla Public License 2.0 | `MPL-2.0` |
127+
| GNU General Public License v3 | `GPL-3.0-or-later` |
128+
| GNU Lesser GPL v3 | `LGPL-3.0-or-later` |
129+
| Python Software Foundation License | `PSF-2.0` |
130+
| MIT-CMU License (Pillow) | `MIT-CMU` |
131+
132+
If no standard SPDX identifier exists (e.g., Inno Setup proprietary license), use a
133+
`LicenseRef-` identifier (e.g., `LicenseRef-Inno-Setup`) and place the license text in
134+
`LICENSES/LicenseRef-Inno-Setup.txt`.
135+
136+
### Example `REUSE.toml` block
137+
138+
```toml
139+
[[annotations]]
140+
path = "credits/simpleeval-LICENCE"
141+
SPDX-FileCopyrightText = "Copyright (c) 2013 Daniel Fairhead"
142+
SPDX-License-Identifier = "MIT"
143+
```
144+
145+
For files that have no copyright notice at all (e.g., the Apache 2.0 generic license text at
146+
`argparse_check_range-LICENSE-2.0`), credit the known package author:
147+
148+
```toml
149+
[[annotations]]
150+
path = "credits/argparse_check_range-LICENSE-2.0"
151+
SPDX-FileCopyrightText = "Dmitriy Kovalev"
152+
SPDX-License-Identifier = "Apache-2.0"
153+
```
154+
155+
---
156+
157+
## Step 6 — Verify REUSE compliance
158+
159+
```bash
160+
reuse lint
161+
```
162+
163+
All reported errors must be resolved before committing.
164+
Common errors and fixes:
165+
166+
| Error | Fix |
167+
|------------------------------------------|------------------------------------------------------------------|
168+
| `credits/<file>: no license identifier` | Add the `SPDX-License-Identifier` to the REUSE.toml annotation |
169+
| `credits/<file>: no copyright notice` | Add `SPDX-FileCopyrightText` to the REUSE.toml annotation |
170+
| `Missing license file LICENSES/<ID>.txt` | Add the license text to `LICENSES/` when using `LicenseRef-` IDs |
171+
172+
---
173+
174+
## Step 7 — Run pre-commit checks
175+
176+
```bash
177+
pre-commit run --all
178+
```
179+
180+
All hooks must pass (ruff, pylint, mypy, reuse, etc.) before pushing.
181+
182+
---
183+
184+
## Summary checklist
185+
186+
- [ ] `pyproject.toml` — dependency added with pinned version
187+
- [ ] `credits/CREDITS.md` — row added to the correct table
188+
- [ ] `credits/update_credits_licenses.py` — entry added to the correct list
189+
- [ ] License file downloaded (`cd credits && python update_credits_licenses.py`)
190+
- [ ] `REUSE.toml``[[annotations]]` block added for each new license file
191+
- [ ] `reuse lint` passes
192+
- [ ] `pre-commit run --all` passes

CONTRIBUTING.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,25 @@ python3 -m ardupilot_methodic_configurator
139139
140140
More detailed usage instructions can be found in our [user manual](https://ardupilot.github.io/MethodicConfigurator/USERMANUAL)
141141
142+
## Managing Dependencies
143+
144+
When adding a new runtime or development dependency, **all** of the following steps must be completed
145+
in order to keep the project REUSE-compliant and credits accurate:
146+
147+
1. **`pyproject.toml`** — add the package with a pinned version.
148+
2. **`credits/CREDITS.md`** — add a row to the "directly uses" or "indirectly uses" table with a
149+
link to the project and its license.
150+
3. **`credits/update_credits_licenses.py`** — add an entry (name + raw license URL) to
151+
`direct_dependencies` or `indirect_dependencies`.
152+
4. **Download the license file** — run `python update_credits_licenses.py` from the `credits/`
153+
directory to fetch the license file(s).
154+
5. **`REUSE.toml`** — add an `[[annotations]]` block for each downloaded license file with the
155+
correct `SPDX-FileCopyrightText` and `SPDX-License-Identifier`.
156+
6. **Verify** — run `reuse lint` and `pre-commit run --all` until all checks pass.
157+
158+
Full details and examples are in
159+
[`.github/instructions/update_software_dependencies.md`](.github/instructions/update_software_dependencies.md).
160+
142161
## Submitting patches
143162
144163
Follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) style for your git commit messages.

LICENSES/BSD-2-Clause.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
BSD 2-Clause License
2+
3+
Redistribution and use in source and binary forms, with or without
4+
modification, are permitted provided that the following conditions
5+
are met:
6+
7+
1. Redistributions of source code must retain the above copyright
8+
notice, this list of conditions and the following disclaimer.
9+
10+
2. Redistributions in binary form must reproduce the above copyright
11+
notice, this list of conditions and the following disclaimer in the
12+
documentation and/or other materials provided with the distribution.
13+
14+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
15+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
16+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
17+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
18+
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
19+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
20+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

LICENSES/LicenseRef-Inno-Setup.txt

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
Inno Setup License
2+
==================
3+
4+
Except where otherwise noted, all of the documentation and software
5+
included in the Inno Setup package is copyrighted by Jordan Russell.
6+
7+
Copyright (C) 1997-2026 Jordan Russell. All rights reserved.
8+
Portions Copyright (C) 2000-2026 Martijn Laan. All rights reserved.
9+
10+
This software is provided "as-is," without any express or implied
11+
warranty. In no event shall the author be held liable for any damages
12+
arising from the use of this software.
13+
14+
Permission is granted to anyone to use this software for any purpose,
15+
including commercial applications, and to alter and redistribute it,
16+
provided that the following conditions are met:
17+
18+
1. All redistributions of source code files must retain all copyright
19+
notices that are currently in place, and this list of conditions
20+
without modification.
21+
22+
2. All redistributions in binary form must retain all occurrences of
23+
the above copyright notice and web site addresses that are currently
24+
in place (for example, in the About boxes).
25+
26+
3. The origin of this software must not be misrepresented; you must not
27+
claim that you wrote the original software. If you use this software
28+
to distribute a product, an acknowledgment in the product
29+
documentation would be appreciated but is not required.
30+
31+
4. Modified versions in source or binary form must be plainly marked as
32+
such, and must not be misrepresented as being the original software.
33+
34+
35+
Jordan Russell
36+
jr-2020 AT jrsoftware.org
37+
https://jrsoftware.org/

REUSE.toml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,3 +185,28 @@ SPDX-License-Identifier = "GPL-3.0-or-later"
185185
path = [".dockerignore", "docker-compose.yml", "Dockerfile"]
186186
SPDX-FileCopyrightText = "2026 ArduPilot methodic configurator developers"
187187
SPDX-License-Identifier = "GPL-3.0-or-later"
188+
189+
[[annotations]]
190+
path = "credits/simpleeval-LICENCE"
191+
SPDX-FileCopyrightText = "Copyright (c) 2013 Daniel Fairhead"
192+
SPDX-License-Identifier = "MIT"
193+
194+
[[annotations]]
195+
path = "credits/pip-system-certs-LICENSE"
196+
SPDX-FileCopyrightText = "Copyright (c) alelec"
197+
SPDX-License-Identifier = "BSD-2-Clause"
198+
199+
[[annotations]]
200+
path = "credits/argparse_check_range-LICENSE-2.0"
201+
SPDX-FileCopyrightText = "Dmitriy Kovalev"
202+
SPDX-License-Identifier = "Apache-2.0"
203+
204+
[[annotations]]
205+
path = "credits/screeninfo-LICENSE.md"
206+
SPDX-FileCopyrightText = "Copyright (c) 2018 Marcin Kurczewski"
207+
SPDX-License-Identifier = "MIT"
208+
209+
[[annotations]]
210+
path = "credits/Inno_Setup-license.txt"
211+
SPDX-FileCopyrightText = "Copyright (C) 1997-2026 Jordan Russell. Portions Copyright (C) 2000-2026 Martijn Laan."
212+
SPDX-License-Identifier = "LicenseRef-Inno-Setup"

credits/CREDITS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,4 @@ These books helped shape this software:
100100
- [The Mythical Man-Month: 2nd Edition by Frederick P. Brooks](https://www.oreilly.com/library/view/mythical-man-month-the/0201835959/)
101101
- [Clean Agile: Back to Basics by Robert C. Martin](https://www.oreilly.com/library/view/clean-agile-back/9780135782002/)
102102
- [Tidy First? by Kent Beck](https://www.oreilly.com/library/view/tidy-first/9781098151232/)
103-
- [Laws of UX by Jon Yablonski](https://www.oreilly.com/library/view/laws-of-ux/9781492055303/)
103+
- [Laws of UX by Jon Yablonski](https://www.oreilly.com/library/view/laws-of-ux/9781492055303/)

credits/Inno_Setup-license.txt

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
Inno Setup License
2+
==================
3+
4+
Except where otherwise noted, all of the documentation and software included in the Inno
5+
Setup package is copyrighted by Jordan Russell.
6+
7+
Copyright (C) 1997-2026 Jordan Russell. All rights reserved.
8+
Portions Copyright (C) 2000-2026 Martijn Laan. All rights reserved.
9+
10+
This software is provided "as-is," without any express or implied warranty. In no event shall
11+
the author be held liable for any damages arising from the use of this software.
12+
13+
Permission is granted to anyone to use this software for any purpose, including commercial
14+
applications, and to alter and redistribute it, provided that the following conditions are met:
15+
16+
1. All redistributions of source code files must retain all copyright notices that are currently
17+
in place, and this list of conditions without modification.
18+
19+
2. All redistributions in binary form must retain all occurrences of the above copyright notice
20+
and web site addresses that are currently in place (for example, in the About boxes).
21+
22+
3. The origin of this software must not be misrepresented; you must not claim that you wrote
23+
the original software. If you use this software to distribute a product, an acknowledgment
24+
in the product documentation would be appreciated but is not required.
25+
26+
4. Modified versions in source or binary form must be plainly marked as such, and must not
27+
be misrepresented as being the original software.
28+
29+
30+
Jordan Russell
31+
jr-2020 AT jrsoftware.org
32+
https://jrsoftware.org/

0 commit comments

Comments
 (0)