Skip to content

feat: validate uv workspace members/excludes and discover parent workspaces (Fixes #290)#352

Draft
karthiknadig wants to merge 1 commit intomainfrom
feature/issue-290
Draft

feat: validate uv workspace members/excludes and discover parent workspaces (Fixes #290)#352
karthiknadig wants to merge 1 commit intomainfrom
feature/issue-290

Conversation

@karthiknadig
Copy link
Member

Addresses the TODO items in pet-uv for workspace member/exclude validation.

Changes

  • Parse [tool.uv.workspace] members and exclude fields instead of using IgnoredAny
  • Add is_workspace_member() with glob pattern matching (using require_literal_separator so * doesn't cross directory boundaries)
  • Walk up parent directories via find_workspace_for_project() to discover workspace roots
  • Stop at the first workspace found — if the project isn't a member of it, it's not part of any workspace
  • Add glob dependency to pet-uv
  • 9 new tests covering member matching, exclusion, implicit members, parent discovery, and deserialization

Fixes #290

cc @zsol — would appreciate your input since you authored the original pet-uv workspace support in #263.

@github-actions
Copy link

github-actions bot commented Feb 24, 2026

Performance Report (Linux) ➖

Metric PR (P50) PR (P95) Baseline (P50) Delta Change
Server Startup 1ms 1ms 1ms 0ms 0%
Full Refresh 78ms 193ms 76ms 2ms 0%

Results based on 10 iterations. P50 = median, P95 = 95th percentile.


Legend
  • 🚀 Significant speedup (>100ms faster)
  • ✅ Faster than baseline
  • ➖ No significant change
  • 🔺 Slower than baseline (>100ms)
  • ⚠️ Significant slowdown (>500ms)

@github-actions
Copy link

github-actions bot commented Feb 24, 2026

Test Coverage Report (Linux)

Metric Value
Current Coverage 59.5%
Base Branch Coverage 58.7%
Delta .8% ✅

Coverage increased! Great work!

@github-actions
Copy link

github-actions bot commented Feb 24, 2026

Performance Report (Windows) ✅

Metric PR (P50) PR (P95) Baseline (P50) Delta Change
Server Startup 9ms 13ms 10ms -1ms -10%
Full Refresh 175ms 1347ms 199ms -24ms -12.1%

Results based on 10 iterations. P50 = median, P95 = 95th percentile.


Legend
  • 🚀 Significant speedup (>100ms faster)
  • ✅ Faster than baseline
  • ➖ No significant change
  • 🔺 Slower than baseline (>100ms)
  • ⚠️ Significant slowdown (>500ms)

@github-actions
Copy link

github-actions bot commented Feb 24, 2026

Test Coverage Report (Windows)

Metric Value
Current Coverage 55.84%
Base Branch Coverage 54.95%
Delta 0.89% ✅

Coverage increased! Great work!

@karthiknadig
Copy link
Member Author

@zsol This is my attempt at addressing the TODOs in the uv crate. Let me know what you think.

@github-actions
Copy link

github-actions bot commented Feb 24, 2026

Performance Report (macOS)

Metric PR (P50) PR (P95) Baseline (P50) Delta
Server Startup 99ms 695ms 55ms 44ms
Full Refresh 163ms 36962ms 114ms 49ms

Results based on 10 iterations. P50 = median, P95 = 95th percentile.


Legend
  • 🚀 Significant speedup (>100ms faster)
  • ✅ Faster than baseline
  • ➖ No significant change
  • 🔺 Slower than baseline (>100ms)
  • ⚠️ Significant slowdown (>500ms)

Copy link
Contributor

@zsol zsol left a comment

Choose a reason for hiding this comment

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

looks good to me, I had one comment

for candidate in path.ancestors() {
/// Walks up from `project_path` looking for a parent workspace that this project belongs to.
/// Returns the workspace environment if found and the project is a valid member.
fn find_workspace_for_project(project_path: &Path) -> Option<PythonEnvironment> {
Copy link
Contributor

Choose a reason for hiding this comment

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

There's one important edge case here: when the project itself is also a workspace (the pyproject.toml defines a [project] as well as [tool.uv.workspace]).
Maybe we should start from project_path instead of its parent?

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.

Feature: Complete TODO items in pet-uv for workspace support

2 participants