Skip to content

fix(pixi-build-python): clarify missing pyproject error#5922

Open
lawrence3699 wants to merge 1 commit intoprefix-dev:mainfrom
lawrence3699:fix/missing-pyproject-error
Open

fix(pixi-build-python): clarify missing pyproject error#5922
lawrence3699 wants to merge 1 commit intoprefix-dev:mainfrom
lawrence3699:fix/missing-pyproject-error

Conversation

@lawrence3699
Copy link
Copy Markdown

Closes #5871

When pixi-build-python is used without a pyproject.toml, metadata loading currently fails with a raw file-open error while reading package metadata.

This changes the metadata provider to surface a dedicated error that states that pixi-build-python requires a pyproject.toml and points at the missing path.

Validation:

  • cargo fmt --all --check
  • cargo test -p pixi-build-python metadata::tests:: -- --nocapture

Copilot AI review requested due to automatic review settings April 19, 2026 17:25
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves UX for pixi-build-python by surfacing a dedicated, actionable error when a project is missing pyproject.toml, instead of bubbling up a low-level file I/O error during metadata loading.

Changes:

  • Added a MissingPyProjectToml MetadataError variant with a clearer message and diagnostic help text.
  • Updated manifest loading to map ErrorKind::NotFound to the new dedicated error.
  • Added a regression test asserting both the error variant and message content when pyproject.toml is absent.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

PyProjectToml(#[from] toml::de::Error),
#[error("failed to parse version from pyproject.toml, {0}")]
ParseVersion(ParseVersionError),
#[error("`pixi-build-python` requires a `pyproject.toml` in {0}")]
Copy link

Copilot AI Apr 19, 2026

Choose a reason for hiding this comment

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

Error message says "requires a pyproject.toml in {0}", but {0} is a full file path (…/pyproject.toml). Using "at {0}" (or changing {0} to be the directory) would read more clearly and avoid implying {0} is a directory.

Suggested change
#[error("`pixi-build-python` requires a `pyproject.toml` in {0}")]
#[error("`pixi-build-python` requires a `pyproject.toml` at {0}")]

Copilot uses AI. Check for mistakes.
);
assert!(
message.contains(&expected_path.display().to_string()),
"error should mention the manifest root: {message}"
Copy link

Copilot AI Apr 19, 2026

Choose a reason for hiding this comment

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

This assertion checks that the error message contains the expected file path (.../pyproject.toml), but the failure text says "mention the manifest root". Updating the assertion message to match what’s actually being checked will make test failures less confusing.

Suggested change
"error should mention the manifest root: {message}"
"error should mention the `pyproject.toml` path: {message}"

Copilot uses AI. Check for mistakes.
@baszalmstra
Copy link
Copy Markdown
Contributor

Thanks this is a great ux improvement!

@baszalmstra
Copy link
Copy Markdown
Contributor

Perhaps one improvement would be if we could surface this error earlier, I think we could surface this in the first few lines of recipe generation. Because now the error still includes that it could read a certain metadata like the homepage. But the backend cannot work without a pyproject.

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.

The python build backend should return a clear error if a pyproject.toml is missing

3 participants