Skip to content

Add python interpreter info to uv workspace metadata#20502

Merged
Gankra merged 3 commits into
mainfrom
gankra/more-meta
Jul 20, 2026
Merged

Add python interpreter info to uv workspace metadata#20502
Gankra merged 3 commits into
mainfrom
gankra/more-meta

Conversation

@Gankra

@Gankra Gankra commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

This should be the same format as uv sync --format json. Several times it's come up that ty might want this info spoon-fed to it and it's just generally nice to have, so let's add it.

Intentionally no changes to the equivalent uv tree json because it doesn't do --sync.

@Gankra Gankra added the preview Experimental behavior label Jul 17, 2026
Comment on lines +121 to 130
/// Information about the Python interpreter in a synchronized environment.
#[derive(Debug, serde::Serialize)]
struct MetadataPython {
/// Absolute path to the Python executable.
path: PortablePathBuf,
/// Full Python version.
version: Version,
/// Python implementation name.
implementation: String,
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we share the type with the sync impl?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Slightly gross because of the crates they're defined in but yeah it works.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We could add a new crate for it, long-term I think there should definitely be shared schemas

/// Full Python version.
version: Version,
/// Python implementation name.
implementation: String,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why isn't this ImplementationName?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The sync impl also used String but I've changed it to untagged LenientImplementationName which... is ultimately just String with extra steps.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The extra steps are what Rust is all about, rite?

Gankra added 3 commits July 20, 2026 10:15
This should be the same format as `uv sync --format json`. Several times it's come up that ty might want this info spoon-fed to it and it's just generally nice to have, so let's add it.

Intentionally no changes to the equivalent `uv tree` json because it doesn't do --sync.
@Gankra
Gankra force-pushed the gankra/more-meta branch from d7119de to 8f118db Compare July 20, 2026 14:17
@Gankra
Gankra enabled auto-merge (squash) July 20, 2026 14:24
@Gankra
Gankra merged commit d43d18e into main Jul 20, 2026
58 checks passed
@Gankra
Gankra deleted the gankra/more-meta branch July 20, 2026 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

preview Experimental behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants