uv
eec8048a - Preserve absolute/relative paths in lockfiles (#18176)

Commit
3 days ago
Preserve absolute/relative paths in lockfiles (#18176) ## Summary Attempt to track and preserve relative/absolute paths when read from files. File URLs are treated as absolute. Synthetic VerbatimUrls shouldn't have a `given`, and are treated as relative. This means that paths passed as absolute will be output as absolute, although they may get normalized. Paths passed as relative will be output as relative but they may be relative to a different location (so that they continue to work going forwards). Previously in various places we'd either make things absolute unconditionally or relative unconditionally. Cases which should now be fixed: - uv.lock - Path dependencies, indexes, and find-links were always converted to relative paths. - pylock.toml export (from_resolution path) - Paths were always relativized. Now preserves the user's original format. - pylock.toml export (from_lock path) - Relative paths from the lock file were being converted to absolute paths. Now uses the path exactly as stored in the lock file. Also noteworthy is the bugfix for a windows misbehaviour. See the commit message for some more information. Note: For now the `uv add` side of this has been split off as a breaking change. ## Test Plan Added missing tests, updated existing. I believe all the changed tests are all now correct and were previously demonstrating buggy behaviour. Well, at least if you are on board with the idea that we should keep relative paths relative and absolute paths and / file URLs absolute. ## Related Issues/PRs * Closes https://github.com/astral-sh/uv/issues/15055 * Closes https://github.com/astral-sh/uv/issues/16602 * Closes https://github.com/astral-sh/uv/issues/16514 * Closes https://github.com/astral-sh/uv/pull/15870
Author
Parents
Loading