Skip to content

Fix source package builds failing with LookupError: hatchling is already being built#68858

Open
sujitdb wants to merge 1 commit intosaltstack:masterfrom
sujitdb:fix/hatchling-binary-source-builds
Open

Fix source package builds failing with LookupError: hatchling is already being built#68858
sujitdb wants to merge 1 commit intosaltstack:masterfrom
sujitdb:fix/hatchling-binary-source-builds

Conversation

@sujitdb
Copy link
Copy Markdown
Collaborator

@sujitdb sujitdb commented Mar 27, 2026

Problem

The nightly Build Source Packages jobs (DEB and RPM) started failing with:

LookupError: hatchling-1.29.0.tar.gz is already being built

Root Cause

Three conditions converged:

  1. pip == 25.2 was pinned in requirements/constraints.txt. pip 25.2 introduced stricter parallel PEP 517 build isolation (parallel_builds=True), which makes the build tracker raise a LookupError when a package is encountered twice in the same build graph.

  2. --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.

  3. hatchling is self-referential — its own pyproject.toml lists hatchling as 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 raises LookupError.

Fix

Add hatchling to --only-binary in onedir_dependencies() in tools/pkg/build.py so 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 / DEB and Build Source Packages / RPM jobs should pass.

Fixes #68858

@sujitdb sujitdb requested a review from a team as a code owner March 27, 2026 22:27
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
@sujitdb sujitdb force-pushed the fix/hatchling-binary-source-builds branch from 871d9e3 to c94985e Compare March 27, 2026 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:full Run the full test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants