Skip to content

Check dependency licenses in CI (Rust and Python) - #327

Open
zuhalsicim wants to merge 1 commit into
restatedev:mainfrom
zuhalsicim:ci/dependency-license-check
Open

zuhalsicim wants to merge 1 commit into
restatedev:mainfrom
zuhalsicim:ci/dependency-license-check

Conversation

@zuhalsicim

Copy link
Copy Markdown

Fixes #182 (part of restatedev/restate#4491).

This adds a "Dependency licenses" workflow with two jobs:

  • Rust: cargo deny check licenses with a new deny.toml, using the same action version as restatedev/restate (EmbarkStudios/cargo-deny-action@v2.1.1).
  • Python: installs the dependencies of every extra with uv sync --all-extras --no-install-project (no SDK build) and runs uvx pip-licenses@5.5.5, which reads its allow list from [tool.pip-licenses] in pyproject.toml.

It runs on PRs and pushes to main that touch Cargo.toml, Cargo.lock, deny.toml, pyproject.toml, uv.lock or the workflow, like deps.yml in restate.

The lists from the issue needed a few changes to pass on today's lockfiles:

  • deny.toml also allows CDLA-Permissive-2.0. webpki-root-certs (Mozilla's root certificates) has only that license. Restate's deny.toml allows it too.
  • cfg_block (via turso_core) has no license field, only a LICENSE file with the Apache-2.0 notice. A clarify entry pins it to that file's hash, so it stops applying if the file changes.
  • Cargo.toml gets license = "MIT", since the crate itself had no license field. The wheel does not change: maturin takes the license from [project] in pyproject.toml, because it is not listed in dynamic.
  • pip-licenses compares license names as strings, and many packages still report classifier names. The issue's list as written fails on the first one (MIT License, aiosqlite). So the allow list has both spellings of each license from the issue, plus MIT-0 (cffi) and the four SPDX expressions in use, for example MPL-2.0 AND (Apache-2.0 OR MIT) (orjson).

I left --partial-match off on purpose. With it, a package licensed MIT AND GPL-3.0-only passes, because "MIT" is a substring. With exact names it fails, and a new license string needs someone to read it and add it.

actions.lock is regenerated with gh actions-lock v0.4.0, and gh actions-lock --verify passes.

How I tested it

Python, against the 105 locked packages of all extras (Windows, Python 3.12):

pip-licenses --python .venv/Scripts/python.exe
# exit 0
# then with a fake package added to the venv, each one fails (exit 1):
#   License-Expression: GPL-3.0-only
#   License-Expression: MIT AND GPL-3.0-only   (passes with --partial-match)
#   Classifier: GNU Lesser General Public License v3 (LGPLv3)

Rust: I don't have cargo-deny locally, so I took the license field of all 393 crates in Cargo.lock from crates.io and checked them against deny.toml with the same rules (SPDX expressions, / as OR). All pass; without CDLA-Permissive-2.0, webpki-root-certs fails. The cfg_block hash is computed the way cargo-deny does it. So the rust job in this PR is the first real cargo-deny run.

Also ruff format --check, ruff check, and zizmor --offline on the new workflow (no findings).

Fixes restatedev#182.

cargo-deny checks the crates of the native extension against deny.toml,
and pip-licenses checks the Python packages of every extra against
[tool.pip-licenses] in pyproject.toml. Both allow lists start from the
ones in the issue.

- deny.toml also allows CDLA-Permissive-2.0 (webpki-root-certs, as in
  restatedev/restate) and clarifies cfg_block, whose only license info
  is a LICENSE file with the Apache-2.0 notice.
- Cargo.toml gets license = "MIT", so the crate itself has a license
  field. The wheel metadata still comes from pyproject.toml.
- pyproject.toml matches license names exactly; besides the issue's
  names it allows MIT-0 (cffi) and the four SPDX expressions in use.
- actions.lock is updated with gh actions-lock.
@github-actions

github-actions Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@zuhalsicim

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add automated dependency license checking (Python + Rust)

1 participant