Repository navigation
Conversation
copy_platform_libraries() copied every file of the c2pa-rs release archive into src/c2pa/libs/, and package_data ships all of them. Next to the shared library that lib.py loads via ctypes, the archives contain a static library, import library, debug symbols and dep-info files (c2pa_c.lib, c2pa_c.dll.lib, c2pa_c.dll.exp, c2pa_c.pdb, libc2pa_c.rlib, libc2pa_c.dylib.dSYM.zip, *.d). None of them is used at runtime. Copy only c2pa_c.dll / libc2pa_c.dylib / libc2pa_c.so, and fail the build if that file is missing instead of packaging whatever the folder holds. Measured with c2pa-rs v0.91.10: the win_amd64 wheel shrinks from 94,949,858 to 9,028,773 bytes. Refs contentauth#346.
tmathern
reviewed
Nov 8, 2026
tmathern
reviewed
Nov 8, 2026
tmathern
reviewed
Nov 8, 2026
PLATFORM_FOLDERS already listed the seven c2pa-rs platform folders, but only its keys were read. Its values now name the library that lib.py loads, so copy_platform_libraries() takes the file name from there and the separate get_native_library_name() mapping is gone. An unknown platform still fails the build. PLATFORM_EXTENSIONS was a third mapping that nothing read, so it is removed. Also applies the docstring wording suggested in review.
Contributor
Author
|
Thanks for the review. Agreed on both points: the I rebuilt the |
ok-nick
approved these changes
Nov 9, 2026
tmathern
approved these changes
Nov 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes in this pull request
Refs #346.
copy_platform_libraries()insetup.pycopied every file from the c2pa-rs release archive intosrc/c2pa/libs/, andpackage_data={"c2pa": ["libs/*"]}shipped all of them.lib.pyloads one file throughctypes:c2pa_c.dll,libc2pa_c.dyliborlibc2pa_c.so. The other files are build outputs that nothing reads at runtime:c2pa_c.lib(static library),c2pa_c.dll.lib,c2pa_c.dll.exp,c2pa_c.pdb,libc2pa_c.rlib,libc2pa_c.dylib.dSYM.zipand the*.ddep-info files.With this change
setup.pycopies only the loaded library. If that file is missing, the build fails; it no longer packages whatever happens to be in the folder. I checked all seven c2pa-rs v0.91.10 archives the workflow uses, and each one contains the expected file name.Measurements (c2pa-rs v0.91.10, package 0.38.4)
Built locally with
python setup.py bdist_wheel --plat-name …, asbuild-wheel.ymldoes:mainwin_amd64libs/c2pa_c.dllonlymanylinux_2_28_x86_64libs/libc2pa_c.soonlyI did not build the other five wheels. Estimated from the compressed sizes in the c2pa-rs archives, they shrink by about 85.8 MB (
win_arm64), 7.0 MB (macosx_11_0_arm64), 6.9 MB (macosx_10_9_x86_64), 6.9 MB (manylinux_2_28_aarch64) and 0.5 MB (macosx_10_9_universal2). That makes each release about 200 MB smaller. 0.38.0 takes 249.5 MB on PyPI, so a release would come to roughly 50 MB.Testing
python:3.10-slimcontainer) and confirmed that the library loads fromsite-packages/c2pa/libs/. On both,pytest tests/test_unit_tests.pygave 463 passed and 47 subtests passed.c2pa.sdk_version()returns0.91.10, andReader("image/jpeg", path).json()reads a signed JPEG.twine checkpasses.I did not add a unit test.
setup.pycallssetup()when it is imported, so a test cannot import it without restructuring the file. The existingtest-built-*-wheeljobs install the built wheels and runtests/test_unit_tests.pyagainst them. That covers six of the seven wheels;universal2has no test job. Because this PR comes from outside the org, those jobs only run after thesafe to testlabel is set.What this does not fix
This PR does not free any space on PyPI. The project uses 10.74 GB of its 10 GB limit, so the next upload will fail either way. Two ways out: a project size increase, or deleting files from old releases. Yanking does not free storage. See https://docs.pypi.org/project-management/storage-limits/. At about 50 MB per release, an increase lasts much longer. It also moves the Windows wheels away from the 100 MB per-file limit:
win_amd64is at 94.9 MB today.Your call
.pdb: it would add about 2.5 MB to each Windows wheel. I left it out because nothing loads it, and the c2pa-rs release archive publishes the same file, so it is still there for symbolizing crash dumps. Keeping it in the wheel is a one-line change.setup.pyas well as inlib.py,c2pa.pyandscripts/build_local_artifacts.py. I did not import them intosetup.pyfor two reasons: importingc2paloads the native library, andscripts/build_local_artifacts.pyis not part of the sdist. Happy to consolidate if you prefer.Checklist
TO DOitems (or similar) have been entered as GitHub issues and the link to that issue has been included in a comment.