uv
10cd6b94 - Normalize extras in lockfile (#3958)

Comment changes are shownComment changes are hidden
Commit
1 year ago
Normalize extras in lockfile (#3958) ## Summary Previously, when we locked something like `flask[dotenv]`, we created two separate distributions in the lockfile: one for `flask`, which included the base dependencies, and one for `flask[dotenv]`, which included the base dependencies _and_ the `dotenv` dependencies. This was easy to implement, but it meant that we were duplicating all of the distribution files for every extra, and duplicating all of the base dependencies for every extra. This PR normalizes the data such that we now have one entry per distribution (i.e., `ExtraName` was removed from `DistributionId`), with an optional dependencies table with an entry per extra, like: ```toml [[distribution]] name = "project" version = "0.1.0" source = "editable+file://[TEMP_DIR]/" sdist = { url = "file://[TEMP_DIR]/" } [[distribution.dependencies]] name = "anyio" version = "3.7.0" source = "registry+https://pypi.org/simple" [distribution.optional-dependencies] [[distribution.optional-dependencies.test]] name = "iniconfig" version = "2.0.0" source = "registry+https://pypi.org/simple" ``` This requires a bit more work upfront, because we now need to merge multiple packages from the `PetGraph` representation when creating the lockfile. Closes https://github.com/astral-sh/uv/issues/3916.
Author
Parents
  • crates
    • uv-resolver/src
      • File
        lock.rs
      • pubgrub
        • File
          dependencies.rs
      • resolution
        • File
          graph.rs
      • snapshots
        • uv_resolver__lock__tests__hash_optional_missing.snap
    • uv
      • src/commands/project
        • File
          lock.rs
      • tests
        • File
          lock.rs