Skip to content

Drop wheel, setuptools and pytest from runtime dependencies - #320

Open
fwittreverce wants to merge 2 commits into
contentauth:mainfrom
fwittreverce:fix/runtime-deps
Open

Drop wheel, setuptools and pytest from runtime dependencies#320
fwittreverce wants to merge 2 commits into
contentauth:mainfrom
fwittreverce:fix/runtime-deps

Conversation

@fwittreverce

@fwittreverce fwittreverce commented Aug 30, 2026

Copy link
Copy Markdown

wheel, setuptools and pytest are declared in [project.dependencies], so
every consumer installs three build/test packages into production environments.
None of the three is imported anywhere under src/.

pytest is re-declared as a PEP 735 [dependency-groups] dev entry rather than
dropped outright, so the manifest still names the test dependency — uv sync
and pip install --group dev pick it up — while keeping it out of the published
package metadata, which [project.optional-dependencies] would not do. The
bound follows requirements-dev.txt (>=8.1.0) rather than the >=7.4.0 the
runtime entry carried; nothing installs the older one today.

Evidence

Every import in the installed package, on main (0.37.9):

Module Imports
src/c2pa/c2pa.py stdlib only
src/c2pa/lib.py stdlib only
src/c2pa/__init__.py stdlib + own module
src/c2pa/build.py requests (line 16), toml (line 97, lazy)

So requests and toml are genuine runtime dependencies — build.py is the
installed download-artifacts console script — and this PR leaves both alone.
wheel, setuptools and pytest are imported by nothing.

This repo already classifies all three correctly in three other places:

  • [build-system] requires already lists setuptools>=68.0.0 and wheel,
    so the build has what it needs; the runtime entries are duplicates.
  • requirements-dev.txt lists wheel and setuptools under
    # Build dependencies and pytest under # Testing dependencies.
  • .github/workflows/build.yml installs pytest explicitly
    (pip install pytest, lines 285 and 377), so CI does not rely on the runtime
    declaration either.

The change is therefore a no-op for this repo's own build and test paths.

Why it is worth doing

They reach production images. In our worker, uv export --frozen --no-dev
the resolver's production set — lists all three. setuptools in particular has
a CVE history, so a security scan has to triage findings for packages the
application never imports.

They mask missing test dependencies downstream, silently. This is the one
that cost us time. Our own test extra was never actually installed — uv sync
does not install extras — and nobody noticed for seven weeks, because pytest
arrived through this dependency chain anyway. Our suite ran on a package no
manifest of ours declared, at a version nobody chose, and a fix we shipped in
that window was inert the whole time. A dependency audit is what eventually
flagged it.

One question, deliberately not in this diff

cryptography is also unimported under src/ — it appears only in examples/
and tests/, and your own requirements.txt says # only used in the training example. It looked like your call rather than mine: dropping it would stop
pip install c2pa-python from giving a reader everything the signing examples
need. Happy to extend the PR if you would rather it went too.

None of the three is imported anywhere under `src/`. `c2pa.py` and `lib.py`
import only the standard library; `build.py` — the `download-artifacts` console
script — imports `requests` and, lazily, `toml`. Those two stay.

They are also already classified correctly elsewhere in the repo:

* `[build-system] requires` already lists `setuptools>=68.0.0` and `wheel`, so
  the build has what it needs and the runtime entries are duplicates.
* `requirements-dev.txt` lists `wheel` and `setuptools` under
  "# Build dependencies" and `pytest` under "# Testing dependencies".
* `.github/workflows/build.yml` installs pytest explicitly (`pip install
  pytest`, lines 285 and 377), so CI does not rely on the runtime declaration
  either.

Removing them is therefore a no-op for this repo's own build and test paths,
and it keeps three packages out of every consumer's production environment.
@tmathern

Copy link
Copy Markdown
Collaborator

For further review and consideration, please make sure to sign the Adobe CLA. You will likely need to close and reopen the PR for the job to pass.

Dropping pytest from `[project.dependencies]` left it undeclared in
pyproject.toml entirely, with `requirements-dev.txt` as the only manifest
naming it. `[dependency-groups] dev` states it where it belongs: installed
for contributors (`uv sync`, `pip install --group dev`) and, unlike
`[project.optional-dependencies]`, absent from the published package
metadata — which is the separation this branch is about.

The bound matches requirements-dev.txt (`pytest>=8.1.0`) rather than the
`>=7.4.0` the runtime entry carried; nothing installs the old one.

The comment above the remaining dependencies goes with it. The rationale
for keeping `toml` and `requests` belongs in the pull request, not in a
manifest that has carried no comments so far.
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.

2 participants