Skip to content

fix: restore python-pydantic and build pydantic-core from vendored crates - #248

Merged
hanthor merged 2 commits into
mainfrom
fix/pydantic-core-vendored
Sep 25, 2026
Merged

hanthor merged 2 commits into
mainfrom
fix/pydantic-core-vendored

Conversation

@hanthor

@hanthor hanthor commented Sep 25, 2026

Copy link
Copy Markdown
Member

Why

Run 36073571248 built every package, but publish failed its consumer-transaction check:

nothing provides python3.14dist(pydantic) needed by input-remapper-2.2.1-1.hum1.bfin.noarch from factory

input-remapper is in the consumer contract (config/bluefin-packages.toml) and requires pydantic at runtime. My #244 removed pydantic after checking only BuildRequires and Utah's manifests. That was wrong, and this PR reverts it.

What

pydantic-core had never built because Fedora's recipe takes every Rust crate as a system RPM (%cargo_generate_buildrequires), and Fedora 44 and Hummingbird ship none of them. It now builds from vendored crates:

  • Generator: tools/generated_sources.py gets a python-pydantic-core generator, following the existing intel-media-driver-free and tailscale precedents. It takes the sha512-pinned PyPI sdist, adds vendor/<crate>-<version> for every crate its Cargo.lock pins, and checks each crates.io download against the Cargo.lock SHA-256. It writes .cargo-checksum.json the way cargo vendor does and repacks deterministically. It uses only the Python standard library, no cargo. Two runs give identical bytes (b20f43b5…), and unit tests cover determinism, lock parsing, refusal of git sources, and a substituted crate failing closed.
  • Source lock: the lock entry becomes a generate entry, and sources is repinned.
  • Spec:
    • uses %cargo_prep -v vendor and drops %cargo_generate_buildrequires;
    • adds %cargo_vendor_manifest and ships cargo-vendor.txt as %license;
    • drops Fedora's two Cargo.toml patches (jiter range, PyO3 0.29). They exist only to match Fedora's crate RPMs, and the lockfile's PyO3 0.28.3 supports Python 3.14.

Verified in fedora:44 + Hummingbird (cargo 1.98.1, Python 3.14.7): cargo check --offline --locked --release on the vendored tree succeeds, and tools/source_pipeline.py python-pydantic-core accepts the generated source.

The counts go back to 373.

docs/contributing.md now says to check the consumer contract's runtime closure before removing a package as "unneeded".

🤖 Generated with Claude Code

https://claude.ai/code/session_01QMTLsnqW2jtz5QsNC3W3qv

hanthor and others added 2 commits September 25, 2026 07:53
…ates

Reverts #244. input-remapper is in the consumer contract
(config/bluefin-packages.toml) and requires python3dist(pydantic) at
runtime, so publish in run 36073571248 failed on
  nothing provides python3.14dist(pydantic) needed by input-remapper
#244 had checked only BuildRequires and Utah's manifests.

pydantic-core never built because Fedora's recipe takes every Rust crate as
a system RPM through %cargo_generate_buildrequires, and Fedora 44 and
Hummingbird ship none of them. Build it vendored instead:

- tools/generated_sources.py gains a python-pydantic-core generator: the
  sha512-pinned PyPI sdist plus vendor/<crate>-<version> for every crate its
  Cargo.lock pins, each download checked against the Cargo.lock SHA-256,
  with .cargo-checksum.json as cargo vendor writes it. Stdlib only, no
  cargo needed; two runs give identical bytes (sha512 b20f43b5...).
- The lock entry becomes a generate entry; `sources` is repinned.
- The spec uses %cargo_prep -v vendor, drops %cargo_generate_buildrequires,
  writes %cargo_vendor_manifest, and drops Fedora's two Cargo.toml patches
  (jiter range, PyO3 0.29) that only exist to match Fedora's crate RPMs;
  the lockfile's PyO3 0.28.3 supports Python 3.14.

Verified in fedora:44 + Hummingbird (cargo 1.98.1, Python 3.14.7):
`cargo check --offline --locked --release` against the vendored tree
succeeds, and tools/source_pipeline.py accepts the generated source.

docs/contributing.md now says to check the runtime closure of the consumer
contract before removing a package as unneeded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QMTLsnqW2jtz5QsNC3W3qv
@hanthor
hanthor merged commit dea8c39 into main Sep 25, 2026
3 checks passed
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.

1 participant