Enforce lockfile schema versions (#8509)

## Summary

Historically, we haven't enforced schema versions. This PR adds a
versioning policy such that, if a uv version writes schema v2, then...

- It will always reject lockfiles with schema v3 or later.
- It _may_ reject lockfiles with schema v1, but can also choose to read
them, if possible.

(For example, the change we proposed to rename `dev-dependencies` to
`dependency-groups` would've been backwards-compatible: newer versions
of uv could still read lockfiles that used the `dev-dependencies` field
name, but older versions should reject lockfiles that use the
`dependency-groups` field name.)

Closes https://github.com/astral-sh/uv/issues/8465.
This commit is contained in:
Charlie Marsh 2024-10-24 12:23:56 -04:00 committed by GitHub
parent b713877bdc
commit 2651aee33f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 201 additions and 18 deletions

View file

@ -4,7 +4,8 @@ pub use exclude_newer::ExcludeNewer;
pub use exclusions::Exclusions;
pub use flat_index::{FlatDistributions, FlatIndex};
pub use lock::{
Lock, LockError, RequirementsTxtExport, ResolverManifest, SatisfiesResult, TreeDisplay,
Lock, LockError, LockVersion, RequirementsTxtExport, ResolverManifest, SatisfiesResult,
TreeDisplay, VERSION,
};
pub use manifest::Manifest;
pub use options::{Flexibility, Options, OptionsBuilder};