🐛 fix(build): carry toml-fmt-common in the sdist - #451
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
The sdist declared Requires-Dist: toml-fmt-common, so a build from it resolved that name from PyPI, where the last upload is 1.3.5 from 2026-05-29. The tree's copy carries the same version number and over 400 different lines, so the install ran May's settings reader against August's formatter. Vendoring ran in build_wheel alone, and only where the sibling Python source sat beside the package. The sdist shipped the Rust crate without it, and build_editable vendored nothing. Fixes tox-dev#450
gaborbernat
force-pushed
the
fix-sdist-vendoring
branch
from
August 31, 2026 20:06
6aaa59d to
9924565
Compare
gaborbernat
enabled auto-merge (squash)
August 31, 2026 20:09
gaborbernat
added a commit
that referenced
this pull request
Aug 31, 2026
pyproject-fmt 2.29.1 and tox-toml-fmt 1.10.1 ship an sdist that carries no `toml-fmt-common` and no dependency naming one, so a wheel built from either fails to import. The wheels on PyPI hold their vendored copy and install as before. #451 removed the dependency and vendored toml-fmt-common in the PEP 517 `build_sdist` hook. A release stops short of that hook, building the sdist through maturin-action, the same bypass the wheel jobs work around by running the backend's CLI afterwards (`_build.yaml:120`). The sdist job had no such step, so what got published skipped the vendoring. ## Changes - The backend CLI patches a tarball as well as a wheel, and exits where the sources it vendors are missing rather than write an artifact that imports nothing. - The sdist job runs that CLI and then reads the tarball back to confirm the sources landed. ## The gate `pkg_sdist` built the sdist with `uv build`, which does reach the hook, so it passed on a path no release takes. It now builds the sdist both ways and runs the release one end to end: ``` maturin sdist → build_backend.py → wheel → empty venv, --no-index → pyproject-fmt --version ``` `--no-index` leaves nothing to fall back on, so a wheel whose common went missing cannot install or import. Against the code this PR fixes, the check fails at the first step.
This was referenced Aug 31, 2026
gaborbernat
added a commit
that referenced
this pull request
Sep 1, 2026
`pytest` against an unpacked 2.29.2 sdist ends with eight errors, all of them `FileNotFoundError` on `pyproject-fmt/pyproject.toml` ([#454](#454)). maturin hoists the package's `pyproject.toml` to the root of the tarball and ships a copy of `build_backend.py` under `pyproject-fmt/`, beside the tests. #451 made the backend read that file from beside itself, which holds in a checkout and in the tarball root, and holds nowhere in the directory the tests load it from. The backend reads it from either place. ## The check that surfaced it `pkg_sdist` built the sdist, built a wheel from it, installed that with `--no-index` and ran the console script. It proved the artifact installs. It never ran the suite the sdist ships, which is what a packager does and what the report in #450 spelled out. It now ends with those steps: unpack the sdist, install it, run the suite it carries. tox supplies the environment and the test group, so the check installs into the interpreter it already runs under rather than building an environment of its own. Against the code this PR fixes the check ends: ``` ======================== 73 passed, 8 errors in 0.79s ======================== ``` the same eight ids #454 lists. With the fix, 81 pass, and 60 for tox-toml-fmt. Fixes #454
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.
What broke
pyproject-fmt 2.29.0 and tox-toml-fmt 1.10.0 ship an sdist that declares
Requires-Dist: toml-fmt-common. A build from it (a distro packager,pip install --no-binary,pip install -e .) resolves that name from PyPI, where the last upload is 1.3.5 from 2026-05-29. This tree's copy carries the same version number and over 400 different lines, so the install runs May's settings reader against August's formatter. #450 reports the 26 test failures that follow.Vendoring ran in
build_wheelalone, and only where../toml-fmt-common/src/toml_fmt_commonsat beside the package:The sdist shipped the Rust
common/crate without the Python sibling, so a build from it took that escape hatch and wrote an unvendored wheel.build_editablevendored nothing.Changes
build_sdistwrites toml-fmt-common's Python sources and itspyproject.tomlinto the tarball, so a wheel built from the sdist vendors like any other.build_editableadds a.pthnaming toml-fmt-common's source directory, so an editable install reads the live sources rather than a published snapshot._MODULEand_COMMONresolve in the sdist layout, where the backend sits at the tarball root rather than beside the package._MODULEnow reads the project name instead of the directory name, which in an sdist ispyproject_fmt-2.29.0.dependencies = ["toml-fmt-common"], and the workspace drops the uv source that pointed it at the local member. Nothing resolves the published distribution now, and a vendor step that goes missing raises an ImportError instead of installing four-month-old code.Why CI missed it
The test environments install a wheel built from the working tree, where the sibling is present, so vendoring ran.
pkg_metabuilt an sdist and then only linted its metadata withtwine check. Thedevenvironment built an editable install and never imported through it.pkg_sdistbuilds the sdist, builds a wheel from it, and fails if that wheel holds no_vendor/toml_fmt_commonor still requires toml-fmt-common. It runs in thecheckmatrix of both packages.devrunsimport toml_fmt_common.Fixes #450