Skip to content

ci(python): bundle third-party licenses in pyiceberg-core wheels - #3493

Merged
kevinjqliu merged 9 commits into
apache:mainfrom
kevinjqliu:kevinjqliu-reimagined-carnival
Oct 26, 2026
Merged

kevinjqliu merged 9 commits into
apache:mainfrom
kevinjqliu:kevinjqliu-reimagined-carnival

Conversation

@kevinjqliu

@kevinjqliu kevinjqliu commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

What changes are included in this PR?

The pyiceberg-core wheels statically link ~280 Rust crates, but the LICENSE and NOTICE in the wheel only cover iceberg-rust. This adds the third-party licenses and notices too. A smaller alternative to #3380.

Use cargo about to generate the third-party licenses when building the wheels. The generate-python-license action combines the root LICENSE, the cargo about output and a few manual entries. The sdist and the in-tree LICENSE/NOTICE symlinks stay as is.

Most of the details are in bindings/python/LICENSING.md.

This is purely mechanical to unblock the 0.11 release. The manual entries (about.toml clarifications and targets, third-party-licenses.txt, third-party-notices.txt) don't update automatically. PR CI only checks that generation doesn't fail, so we need to check them by hand before every release.

Also, proc-macro crates are over-listed since cargo about can't filter them.

Are these changes tested?

Built the wheel locally and checked dist-info/licenses/. PR CI also runs the action on Linux, macOS and Windows, with no cargo about warnings.

Here's what the generated LICENSE and NOTICE look like.

AI Disclosure

Written with Copilot (Claude). Please check the ASF policy reading (accepted licenses in about.toml, NOTICE handling) and the manual entries. Not reviewed by ASF legal. The release and nightly workflows haven't run end to end, and windows-11-arm isn't covered by PR CI.

@kevinjqliu
kevinjqliu force-pushed the kevinjqliu-reimagined-carnival branch 4 times, most recently from 4a82ec6 to 8631c28 Compare October 20, 2026 21:43

@kevinjqliu kevinjqliu left a comment •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is good enough for a convenience artifact...
honestly, id even drop the edge cases (zstd-sys, brotli and the NOTICE file)... but keeping it as since the diff isnt too big

Comment thread .github/workflows/release_python.yml Resolved
Comment thread .github/workflows/release_python.yml Resolved
ignore-build-dependencies = true
ignore-dev-dependencies = true

# zstd-sys vendors zstd's C code (BSD-3-Clause, Meta) next to the Rust

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zstd-sys always compiles zstd's core C library 😭

but these changes dont look so bad

Comment thread bindings/python/LICENSE Resolved
Comment thread bindings/python/NOTICE Resolved
@kevinjqliu
kevinjqliu marked this pull request as ready for review October 20, 2026 23:38
Copilot AI balanced review requested due to automatic review settings October 20, 2026 23:38
@kevinjqliu

Copy link
Copy Markdown
Contributor Author

cc @dannycjones @CTTY @blackmwk

let me know what you think about this solution. I don't think we need to over index much on LICENSE and NOTICE. Including the dependencies in LICENSE (via cargo about) is good enough in my opinion, esp since this is just a connivence artifact. The source distribution's LICENSE is still correct.

@kevinjqliu kevinjqliu mentioned this pull request Oct 20, 2026
3 tasks

This comment was marked as outdated.

@blackmwk blackmwk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes for two attribution issues in 8631c28:

  1. [P2] Preserve libm's attribution in the generated LICENSE. The new generation command succeeds with cargo-about 0.9.2 and --fail, but the output for libm 0.2.16 contains Copyright (c) <year> <copyright holders>. It omits the actual notices for Jorge Aparicio, musl, and other contributors from libm's packaged LICENSE.txt. Please add a checksum-verified libm clarification preserving that license text and its notices. A temporary clarification pointing to LICENSE.txt was tested and restored the missing notices. A focused check of the generated output would help catch this silent fallback.

  2. [P2] Keep a valid LICENSE for builds outside the release workflows. The new bindings/python/LICENSE is only a placeholder, while generation is confined to the release workflows. Running maturin sdist directly succeeds and packages those four lines as the declared LICENSE. Local wheel builds and the Python PR CI workflow also bypass generation. Please retain a real Apache LICENSE in-tree, or integrate generation into the packaging process so these build paths cannot ship the placeholder. This confirms the existing Copilot comment.

Also, please treat #3495 as a merge prerequisite for the acknowledged zstd omission, or include the legacy notices here. At the reviewed commit, cargo tree still shows zstd-sys/legacy enabled, while the generated LICENSE omits its BSD-2 notices.

Validation: ran the pinned cargo-about 0.9.2 command, built and inspected an sdist with maturin 1.9.4, checked dependency features and upstream license files, and tested the libm clarification separately. The full wheel build matrix was not run.

@dannycjones dannycjones left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Kevin, I appreciate that you want to reduce the amount of code we're burdened with maintaining. I think this is especially valuable given the bindings here are a bit niche within the wider iceberg-rust project.

The difference between this approach and the approach in my PR is that this one lacks the defensive checks against falling short of meeting the license obligations.

For example, Renjie's comment flags an unmet obligation for libm: #3493 (review)

There's obviously a big cost to maintaining the scripts around that (and I'd rather see them made upstream into cargo-about, which we could do over time), so I certainly understand and share your concern on that. My opinion here was to accept the cost of a more complex script that gives us more confidence that we're not going to find other licensing issues pop up later as our dependencies evolve, with the assumption that the script once written remains largely static.

Also noting: we don't block CI here on inability to generate the license attribution notices. We do have the nightly release but I imagine it isn't monitored. (I think this one is an easy fix?)

To try and reach consensus here: I am OK with taking a more hardcoded approach, and we track somewhere that this is the decision taken. I am happy to explore at a later date what checks we can upstream to cargo-about/cargo-deny from my original PR so that we get those for free later on, and slowly become less open to the risks I've been worried about.

Comment thread bindings/python/about.hbs Resolved
Comment thread bindings/python/LICENSE Resolved
Comment thread bindings/python/NOTICE Resolved
@dannycjones

Copy link
Copy Markdown
Contributor

I missed Renjie's comment on the other PR, sharing here. Renjie shares the concern that the maintenance cost is not worth it, so we should stick to the simpler solution.

#3414 (review)

I'm OK to move forward with the simpler approach.

@kevinjqliu
kevinjqliu force-pushed the kevinjqliu-reimagined-carnival branch 13 times, most recently from 6aa1013 to e72b58b Compare October 22, 2026 17:27
@kevinjqliu
kevinjqliu marked this pull request as draft October 22, 2026 17:30
@kevinjqliu
kevinjqliu force-pushed the kevinjqliu-reimagined-carnival branch from e72b58b to cf499cb Compare October 22, 2026 17:44
@kevinjqliu
kevinjqliu force-pushed the kevinjqliu-reimagined-carnival branch from 84b0100 to 9717e29 Compare October 22, 2026 20:36
@blackmwk

Copy link
Copy Markdown
Contributor

Hi, @kevinjqliu Do you think this is ready for review or you still need some refinement?

@kevinjqliu kevinjqliu left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I documented the changes in LICENSING.md

with:
key: bindings-python
save-if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
- uses: $/.github/actions/generate-python-license

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on PR CI, check if cargo about can fail. this gives us a early and clear signal on any dependency changes

uses: $/.github/actions/setup-builder
with:
rust-version: ${{ steps.get-msrv.outputs.msrv }}
- uses: $/.github/actions/generate-python-license

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only run when building wheels

@@ -0,0 +1,30 @@
This package bundles the following Rust dependencies that ship their own NOTICE.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as mentioned in the pr description, this is manually maintained. i checked with my agent a couple of times.

i think this is good enough for now to unblock 0.11 release

run: |
cargo about generate -c about.toml --locked --fail --manifest-path Cargo.toml about.hbs > third-party-licenses.txt
# Both are symlinks to the root files, remove them so the redirects don't write through.
rm LICENSE NOTICE

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

both bindings/python/LICENSE and https://github.com/apache/iceberg-rust/blob/ca21f1587c6caaeb88dd3a9e1cc245747e1aba08/bindings/python/NOTICE already exist and symlinks to the root LICENSE/NOTICE.

they are needed by the sdist.

During generation we need to remove them first in order to regenerate these files

# Both are symlinks to the root files, remove them so the redirects don't write through.
rm LICENSE NOTICE
cat ../../LICENSE third-party-licenses.txt > LICENSE
{ cat ../../NOTICE; echo; cat third-party-notices.txt; } > NOTICE

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

final NOTICE is root NOTICE + our hand written one in bindings/python/third-party-notices.txt

cargo about generate -c about.toml --locked --fail --manifest-path Cargo.toml about.hbs > cargo-about-output.txt
# Both are symlinks to the root files, remove them so the redirects don't write through.
rm LICENSE NOTICE
cat ../../LICENSE cargo-about-output.txt third-party-licenses.txt > LICENSE

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

final LICENSE is root LICENSE + cargo about output + manual entries (third-party-licenses.txt)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trying to describe most of the changes. I can also leave out this file and just move the content to the PR description

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do need to keep this this, so we can understand how to maintain these.

| xargs -I{} find {} -maxdepth 1 -iname 'NOTICE*'
```

## Keeping entries up to date

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we can automate this, but for now i am happy with the current solution in order to unblock 0.11 release

@kevinjqliu
kevinjqliu marked this pull request as ready for review October 23, 2026 18:33
@kevinjqliu

Copy link
Copy Markdown
Contributor Author

@blackmwk @dannycjones mind giving this another look?

i iterated on this a bunch, and i think this is the best i can do right now to balance release and maintenance. This can unblock us for now and we can iterate more after

@dannycjones dannycjones left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generally lgtm, I think the main thing is that we should ensure there's a step in the release guide to check licenses. it'll be a bit ambiguous for now, although I'm hoping there's a Magpie skill to help out here

Comment thread bindings/python/third-party-notices.txt Resolved

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do need to keep this this, so we can understand how to maintain these.

Comment thread bindings/python/LICENSING.md Resolved
Comment on lines +37 to +41
The action is used in these workflows:

- [`release_python.yml`](../../.github/workflows/release_python.yml): the release wheels published to PyPI.
- [`release_python_nightly.yml`](../../.github/workflows/release_python_nightly.yml): the nightly wheels published to TestPyPI.
- [`bindings_python_ci.yml`](../../.github/workflows/bindings_python_ci.yml): pull requests. It only checks that generation doesn't fail. The generated files are not published.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpicky: we can just drop this, it is easy to find and this is easy to grow stale.

Comment thread bindings/python/LICENSING.md Resolved
Comment thread bindings/python/about.toml Resolved
Comment on lines +31 to +36
run: |
cargo about generate -c about.toml --locked --fail --manifest-path Cargo.toml about.hbs > cargo-about-output.txt
# Both are symlinks to the root files, remove them so the redirects don't write through.
rm LICENSE NOTICE
cat ../../LICENSE cargo-about-output.txt third-party-licenses.txt > LICENSE
{ cat ../../NOTICE; echo; cat third-party-notices.txt; } > NOTICE

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My preference on GHA is to have as much logic as we can in Python scripts, so GHA is a thin orchestration layer installing dependencies and executing individual scripts which can be reproduced locally.

(I don't want to block on this, but I think this is the direction we should head.)

@blackmwk blackmwk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @kevinjqliu for this pr, LGTM! Just one minor suggestion, not a blocker.

#
# Accepted licenses must be ASF Category A or B:
# https://www.apache.org/legal/resolved.html
accepted = [

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Could we have some way to check it's in sync with deny.toml?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea we can, I'll follow up and make more improvements to the process.

@blackmwk
blackmwk added this pull request to the merge queue Oct 26, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 26, 2026

@dannycjones dannycjones left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks Kevin

@dannycjones

Copy link
Copy Markdown
Contributor

I think we can try this one again on the merge queue, now that the CI issue is resolved.

@kevinjqliu
kevinjqliu added this pull request to the merge queue Oct 26, 2026
@kevinjqliu

Copy link
Copy Markdown
Contributor Author

This PR gets us the correct structure for the LICENSE and NOTICE files, and unblocks 0.11 release. I'll follow up to improve the process and make it easier to maintain

Merged via the queue into apache:main with commit 32acec6 Oct 26, 2026
25 checks passed
@kevinjqliu
kevinjqliu deleted the kevinjqliu-reimagined-carnival branch October 26, 2026 17:52
dannycjones added a commit to dannycjones/iceberg-rust that referenced this pull request Oct 27, 2026
This branch's bindings pull in iceberg-datafusion and iceberg-storage-opendal
with opendal-all for the DataFusion table provider, so the wheel's crate graph
is much wider than main's and cargo-about needs more than apache#3493 configured.

- Accept bzip2-1.0.6 and, per-crate, MPL-2.0 for colored and option-ext.
  They arrive through opendal-all -> services-hf -> hf-xet -> xet-runtime and
  iceberg-datafusion -> async-compression -> bzip2. Without them generation
  fails and no wheel can be built.
- Clarify aws-lc-sys, reached through opendal -> reqwest -> rustls ->
  aws-lc-rs. It ships every license it grants in one combined file, so
  cargo-about matched none of them and synthesized SPDX templates for three of
  the four, one with an empty copyright line.
- Drop aarch64-pc-windows-msvc from targets; this branch builds no
  windows-arm wheel.

The zstd-sys clarification is deliberately kept. It is redundant on main, which
is on zstd-sys 2.1.2, but this branch pins 2.0.16 where removing it drops the
Facebook and Meta notices.

Co-authored-by: Danny C Jones <[email protected]>
dannycjones added a commit to dannycjones/iceberg-rust that referenced this pull request Oct 27, 2026
This branch's bindings pull in iceberg-datafusion and iceberg-storage-opendal
with opendal-all for the DataFusion table provider, so the wheel's crate graph
is much wider than main's and cargo-about needs more than apache#3493 configured.

- Accept bzip2-1.0.6 and, per-crate, MPL-2.0 for colored and option-ext.
  They arrive through opendal-all -> services-hf -> hf-xet -> xet-runtime and
  iceberg-datafusion -> async-compression -> bzip2. Without them generation
  fails and no wheel can be built.
- Clarify aws-lc-sys, reached through opendal -> reqwest -> rustls ->
  aws-lc-rs. It ships every license it grants in one combined file, so
  cargo-about matched none of them and synthesized SPDX templates for three of
  the four, one with an empty copyright line.
- Drop aarch64-pc-windows-msvc from targets; this branch builds no
  windows-arm wheel.

The zstd-sys clarification is deliberately kept. It is redundant on main, which
is on zstd-sys 2.1.2, but this branch pins 2.0.16 where removing it drops the
Facebook and Meta notices.

We use the 0.11.x convention on GitHub Actions composite actions as we've not updated Zizmor here.

Co-authored-by: Danny C Jones <[email protected]>
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.

4 participants