Skip to content

refactor: improve type safety and API clarity#3074

Merged
messense merged 2 commits into
PyO3:mainfrom
messense:improve-api
Mar 9, 2026
Merged

refactor: improve type safety and API clarity#3074
messense merged 2 commits into
PyO3:mainfrom
messense:improve-api

Conversation

@messense

@messense messense commented Mar 9, 2026

Copy link
Copy Markdown
Member
  • source_distribution/unpack.rs: Replace bare (TempDir, PathBuf, PathBuf) tuple with named UnpackedSdist struct for self-documenting fields
  • target/mod.rs: Change get_supported_architectures() to return &'static [Arch] instead of allocating Vec on every call

- source_distribution/unpack.rs: Replace bare (TempDir, PathBuf, PathBuf)
  tuple with named UnpackedSdist struct for self-documenting fields
- target/mod.rs: Change get_supported_architectures() to return
  &'static [Arch] instead of allocating Vec<Arch> on every call

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Refactors sdist unpacking to use a named return type for clearer APIs and updates architecture support lookup to avoid per-call allocations.

Changes:

  • Introduces UnpackedSdist to replace the (TempDir, PathBuf, PathBuf) tuple return from unpack_sdist().
  • Updates call sites (tests + build flow) to destructure UnpackedSdist.
  • Updates get_supported_architectures() to return &'static [Arch] instead of allocating Vec<Arch> each call.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/run/sdist.rs Updates tests to destructure the new UnpackedSdist return type.
tests/common/other.rs Updates shared test helper to destructure UnpackedSdist.
src/target/mod.rs Returns static slices for supported architectures (no allocations).
src/source_distribution/unpack.rs Adds UnpackedSdist struct and returns it from unpack_sdist().
src/source_distribution/mod.rs Re-exports UnpackedSdist from the module.
src/metadata.rs Replaces vec![]/Default::default() with explicit constructors (no semantic change).
src/main.rs Adapts wheel-from-sdist build flow to new unpack API; renames local struct.
src/lib.rs Re-exports UnpackedSdist from the crate root API.

Comment thread src/main.rs Outdated
Comment thread src/target/mod.rs
Comment thread src/source_distribution/unpack.rs
@messense messense merged commit 231f969 into PyO3:main Mar 9, 2026
35 of 36 checks passed
@messense messense deleted the improve-api branch March 9, 2026 12:08
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.

2 participants