Skip to content

Conversation

@LalatenduMohanty
Copy link
Member

@LalatenduMohanty LalatenduMohanty commented Dec 1, 2025

--test-mode enables resilient bootstrap processing that continues building packages even when individual builds fail, instead of stopping at the first error.

When a package fails to build from source, it attempts to download a pre-built wheel as a fallback, and if both fail, records the failure and continues processing remaining packages.

At the end, it generates JSON reports containing all failure details. The files go to work_dir/ like other outputs.

Closes #713

@LalatenduMohanty LalatenduMohanty requested a review from a team as a code owner December 1, 2025 04:44
@LalatenduMohanty LalatenduMohanty changed the title Adding bootstrap --testmode Adding bootstrap --test-mode Dec 1, 2025
@mergify mergify bot added the ci label Dec 1, 2025
@LalatenduMohanty LalatenduMohanty force-pushed the take3_bootstrap_testmode branch 2 times, most recently from 197a919 to 539fe7c Compare December 4, 2025 17:13
@LalatenduMohanty LalatenduMohanty force-pushed the take3_bootstrap_testmode branch 3 times, most recently from 4b69da3 to 6b2e255 Compare December 4, 2025 19:20
@LalatenduMohanty LalatenduMohanty force-pushed the take3_bootstrap_testmode branch 4 times, most recently from 905415a to 72ba5d2 Compare December 9, 2025 20:45
@LalatenduMohanty LalatenduMohanty force-pushed the take3_bootstrap_testmode branch 6 times, most recently from 6bd4206 to 103d280 Compare December 18, 2025 19:58
@LalatenduMohanty LalatenduMohanty marked this pull request as draft December 18, 2025 20:10
@LalatenduMohanty LalatenduMohanty force-pushed the take3_bootstrap_testmode branch 3 times, most recently from c3b9057 to 2fb2f20 Compare December 18, 2025 21:28
@LalatenduMohanty LalatenduMohanty marked this pull request as ready for review December 18, 2025 21:43
Add test mode that continues processing after build failures instead
of failing fast. Useful for testing build configurations across many
packages.

When enabled:
- Catches any exception during bootstrap
- Logs the error with full traceback
- Records the failed package name
- Continues to the next package
- Exits non-zero at completion if any failures

Closes python-wheel-build#713

Co-Authored-By: Claude <[email protected]>

Signed-off-by: Lalatendu Mohanty <[email protected]>
@LalatenduMohanty LalatenduMohanty force-pushed the take3_bootstrap_testmode branch 3 times, most recently from a01c677 to 0c2fe3f Compare December 19, 2025 11:38
Store failure details (package, version, exception info) and write
test-mode-failures.json to work directory for post-analysis.

Co-Authored-By: Claude <[email protected]>

Signed-off-by: Lalatendu Mohanty <[email protected]>
@LalatenduMohanty LalatenduMohanty force-pushed the take3_bootstrap_testmode branch 2 times, most recently from 1d40126 to 182adca Compare December 19, 2025 12:08
Added type-safe failure categorization for --test-mode.

Hook and dependency extraction failures are now logged as warnings
and allow processing to continue, while resolution and bootstrap
failures remain fatal to the package.

Co-Authored-By: Claude <[email protected]>

Signed-off-by: Lalatendu Mohanty <[email protected]>
Copy link
Member

@dhellmann dhellmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a few suggestions for cleanup, but I think this is ready to merge.



@pytest.fixture
def mock_context() -> typing.Generator[context.WorkContext, None, None]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's already a fixture for making a temporary context. It's configured with some pytest magic so that if you name an argument to a test method tmp_context you get a context in a temporary directory that is also managed by pytest. https://github.com/python-wheel-build/fromager/blob/main/tests/conftest.py#L24

We can clean that up in a follow-up, though, so you can keep moving forward with this.

except Exception as err:
if not self.test_mode:
raise
# Get version from cache if available
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We wouldn't need this logic if we move the resolution step out of _bootstrap_impl into this function where we can see whether it resolved in the first place. Let's do that in another PR.

# we're given.
self.why.append((req_type, req, resolved_version))
# Track dependency chain for error messages - context manager ensures cleanup
with self._track_why(req_type, req, resolved_version):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we move the resolution logic up into bootstrap then this context manager can also move there because we will have the resolved version.

wheel_filename = None
sdist_filename = self._build_sdist(
req, resolved_version, sdist_root_dir, build_env
def _handle_test_mode_failure(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we add a force_prebuilt flag to _bootstrap_impl then we wouldn't need this function and we could avoid some duplication of the logic for handling pre-built wheels. Let's consider that in a follow-up PR.

@mergify mergify bot merged commit af19f7b into python-wheel-build:main Dec 19, 2025
118 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bootstrap test mode

2 participants