Fix source package builds failing with LookupError: hatchling is already being built#68858
Open
sujitdb wants to merge 1 commit intosaltstack:masterfrom
Open
Fix source package builds failing with LookupError: hatchling is already being built#68858sujitdb wants to merge 1 commit intosaltstack:masterfrom
sujitdb wants to merge 1 commit intosaltstack:masterfrom
Conversation
dwoz
requested changes
Mar 27, 2026
Add hatchling to --only-binary in onedir_dependencies() so pip installs it from its universal wheel instead of attempting a source build. When --no-binary :all: is active (Linux builds), pip 25.2 tries to source-build hatchling but hatchling lists itself as its own PEP 517 build backend, causing pip's build tracker to raise: LookupError: hatchling is already being built Fixes saltstack#68858 Made-with: Cursor
871d9e3 to
c94985e
Compare
dwoz
approved these changes
Mar 27, 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.
Problem
The nightly
Build Source Packagesjobs (DEB and RPM) started failing with:Root Cause
Three conditions converged:
pip == 25.2was pinned inrequirements/constraints.txt. pip 25.2 introduced stricter parallel PEP 517 build isolation (parallel_builds=True), which makes the build tracker raise aLookupErrorwhen a package is encountered twice in the same build graph.--no-binary :all:is used on Linux to force source builds of all packages. This causes pip to spin up an isolated subprocess to install each package's PEP 517 build backend.hatchlingis self-referential — its ownpyproject.tomllistshatchlingas the build backend. So when pip tries to source-build any package that uses hatchling, it needs to install hatchling first, which triggers another hatchling source build → pip's build tracker detects the cycle and raisesLookupError.Fix
Add
hatchlingto--only-binaryinonedir_dependencies()intools/pkg/build.pyso pip always installs it from its pre-built universal wheel, bypassing the circular source-build entirely.Testing
Trigger the nightly workflow — the
Build Source Packages / DEBandBuild Source Packages / RPMjobs should pass.Fixes #68858