Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Checklist
docsis updatedDescription of changes
Add support for uv workspaces
Closes #1060.
Why
uv's own docs call out a gap deptry can fill:
Until now deptry treated a uv workspace as a single project, so the only way to run deptry correctly on a uv workspace is to invoke it once for each workspace member. Even that is suboptimal, because deptry is not aware of the other packages+modules in the workspace while scanning one of them.
Approach
Coredetects whether the project is a plain project or a uv workspace and dispatches to eitherProjectScanneror the newUvWorkspaceScanner. TheUvWorkspaceScannerscanner runsProjectScanneronce per member with a lightly adapted config (reading each member's own[tool.deptry]section), and builds a globalpackage -> top-level modulesmap up front by resolving each member's editable.pthfile viaimportlib.metadataso a member can recognise sibling packages by their import name, not just their distribution name. Dev deps declared at the workspace root are merged into each member scan, since they live in the shared environment.New error codes
DEP101DEP102DEP003.Both are demonstrated by
tests/fixtures/uv_workspace/:bardeclarespandasbut never uses it →DEP002bazimportsbar2(from siblingbar) without declaringbar→DEP101fooimportspandaswithout declaring it; only resolves viabar→DEP102Assumptions
uv sync --all-packagesso every member is editable-installed. The package-to-module map walks editable.pthfiles; members that aren't installed are silently skipped.pyproject.tomlwith a[project]table and a discoverable top-level module.TODO