Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: correct condition to downweigh track-feature packages #545

Merged
merged 2 commits into from
Feb 27, 2024

Conversation

wolfv
Copy link
Contributor

@wolfv wolfv commented Feb 27, 2024

We use track features to de-prioritize packages.
Sometimes, the solver is forced to select a given package, e.g. when selecting numpy-XY-<hash> it might have a dependency on pypy. Numpy variants themselves are not down-prioritized, though.

If we detect that a package forces only dependencies that have track features (such as the case for the numpy variant that only works together with pypy) we also "inherit" the down-weighing to numpy (otherwise the solver would be forced to use pypy later on).

We already had the code for this but it was missing a ! – this PR corrects that.

@baszalmstra
Copy link
Collaborator

Do you think it would be possible to add a test for this? We already have the repodata in the repository so the test should be able to run fairly quickly!

@wolfv wolfv force-pushed the track-features-dependencies branch from 1a54e18 to a1d8480 Compare February 27, 2024 12:06
@wolfv
Copy link
Contributor Author

wolfv commented Feb 27, 2024

So everything worked fine if there is only a single package with the track feature. I had to change the repodata to contain 2 builds of

    "python_abi-3.9-2_cp39.tar.bz2": {
      "build": "2_cp39",
      "build_number": 2,
      "constrains": [
        "pypy <0a0"
      ],
      "depends": [
        "python 3.9.*"
      ],
      "license": "BSD-3-Clause",
      "license_family": "BSD",
      "md5": "39adde4247484de2bb4000122fdcf665",
      "name": "python_abi",
      "sha256": "67231829ea0101fee30c68f788fdba40a11bbee8fdac556daaab5832bd27bf3d",
      "size": 4017,
      "subdir": "linux-64",
      "timestamp": 1624472010037,
      "version": "3.9"
    },

And that way I could reproduce the issue + make sure the fix works by adding snapshots.

@baszalmstra baszalmstra merged commit b08af41 into conda:main Feb 27, 2024
14 checks passed
@github-actions github-actions bot mentioned this pull request Feb 27, 2024
baszalmstra added a commit that referenced this pull request Mar 6, 2024
## 🤖 New release
* `rattler`: 0.19.0 -> 0.19.1 (✓ API compatible changes)
* `rattler_conda_types`: 0.19.0 -> 0.20.0 (✓ API compatible changes)
* `rattler_digest`: 0.19.0 -> 0.19.1 (✓ API compatible changes)
* `rattler_macros`: 0.19.0 -> 0.19.1
* `rattler_package_streaming`: 0.19.0 -> 0.19.1 (✓ API compatible
changes)
* `rattler_networking`: 0.19.0 -> 0.19.1 (✓ API compatible changes)
* `rattler_lock`: 0.19.0 -> 0.20.0 (⚠️ API breaking changes)
* `rattler_repodata_gateway`: 0.19.0 -> 0.19.1 (✓ API compatible
changes)
* `rattler_solve`: 0.19.0 -> 0.20.0 (✓ API compatible changes)
* `rattler_libsolv_c`: 0.19.0 -> 0.19.1 (✓ API compatible changes)
* `rattler_virtual_packages`: 0.19.0 -> 0.19.1 (✓ API compatible
changes)
* `rattler_index`: 0.19.0 -> 0.19.1 (✓ API compatible changes)
* `rattler_shell`: 0.19.0 -> 0.19.1 (✓ API compatible changes)

### ⚠️ `rattler_lock` breaking changes

```
--- failure enum_variant_added: enum variant added on exhaustive enum ---

Description:
A publicly-visible enum without #[non_exhaustive] has a new variant.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#enum-variant-new
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.29.1/src/lints/enum_variant_added.ron

Failed in:
  variant ParseCondaLockError:InvalidPypiPackageName in /tmp/.tmpLu7Njp/rattler/crates/rattler_lock/src/parse/mod.rs:37
```

<details><summary><i><b>Changelog</b></i></summary><p>

## `rattler`
<blockquote>

##
[0.19.1](rattler-v0.19.0...rattler-v0.19.1)
- 2024-03-06

### Added
- generalised CLI authentication
([#537](#537))

### Fixed
- removal of multiple packages that clobber each other
([#556](#556))
- dont use workspace dependencies for local crates
([#546](#546))

### Other
- every crate should have its own version
([#557](#557))
</blockquote>

## `rattler_conda_types`
<blockquote>

##
[0.20.0](rattler_conda_types-v0.19.0...rattler_conda_types-v0.20.0)
- 2024-03-06

### Added
- [**breaking**] optional strict parsing of matchspec and versionspec
([#552](#552))

### Fixed
- patch unsupported glob operators
([#551](#551))
- dont use workspace dependencies for local crates
([#546](#546))

### Other
- every crate should have its own version
([#557](#557))
</blockquote>

## `rattler_digest`
<blockquote>

##
[0.19.1](rattler_digest-v0.19.0...rattler_digest-v0.19.1)
- 2024-03-06

### Other
- every crate should have its own version
([#557](#557))
</blockquote>

## `rattler_macros`
<blockquote>

##
[0.19.1](rattler_macros-v0.19.0...rattler_macros-v0.19.1)
- 2024-03-06

### Other
- every crate should have its own version
([#557](#557))
</blockquote>

## `rattler_package_streaming`
<blockquote>

##
[0.19.1](rattler_package_streaming-v0.19.0...rattler_package_streaming-v0.19.1)
- 2024-03-06

### Fixed
- dont use workspace dependencies for local crates
([#546](#546))

### Other
- every crate should have its own version
([#557](#557))
</blockquote>

## `rattler_networking`
<blockquote>

##
[0.19.1](rattler_networking-v0.19.0...rattler_networking-v0.19.1)
- 2024-03-06

### Fixed
- add snapshot test and use btreemap in file backend
([#543](#543))

### Other
- every crate should have its own version
([#557](#557))
</blockquote>

## `rattler_lock`
<blockquote>

##
[0.20.0](rattler_lock-v0.19.0...rattler_lock-v0.20.0)
- 2024-03-06

### Added
- sort extras by name and urls by filename
([#540](#540))

### Fixed
- dont use workspace dependencies for local crates
([#546](#546))

### Other
- every crate should have its own version
([#557](#557))
- bump pep508_rs and pep440_rs
([#549](#549))
</blockquote>

## `rattler_repodata_gateway`
<blockquote>

##
[0.19.1](rattler_repodata_gateway-v0.19.0...rattler_repodata_gateway-v0.19.1)
- 2024-03-06

### Fixed
- correct condition to downweigh track-feature packages
([#545](#545))
- dont use workspace dependencies for local crates
([#546](#546))

### Other
- every crate should have its own version
([#557](#557))
</blockquote>

## `rattler_solve`
<blockquote>

##
[0.20.0](rattler_solve-v0.19.0...rattler_solve-v0.20.0)
- 2024-03-06

### Added
- [**breaking**] optional strict parsing of matchspec and versionspec
([#552](#552))

### Fixed
- removal of multiple packages that clobber each other
([#556](#556))
- correct condition to downweigh track-feature packages
([#545](#545))
- dont use workspace dependencies for local crates
([#546](#546))

### Other
- every crate should have its own version
([#557](#557))
</blockquote>

## `rattler_libsolv_c`
<blockquote>

##
[0.19.1](rattler_libsolv_c-v0.19.0...rattler_libsolv_c-v0.19.1)
- 2024-03-06

### Other
- every crate should have its own version
([#557](#557))
</blockquote>

## `rattler_virtual_packages`
<blockquote>

##
[0.19.1](rattler_virtual_packages-v0.19.0...rattler_virtual_packages-v0.19.1)
- 2024-03-06

### Fixed
- dont use workspace dependencies for local crates
([#546](#546))

### Other
- every crate should have its own version
([#557](#557))
</blockquote>

## `rattler_index`
<blockquote>

##
[0.19.1](rattler_index-v0.19.0...rattler_index-v0.19.1)
- 2024-03-06

### Fixed
- dont use workspace dependencies for local crates
([#546](#546))

### Other
- every crate should have its own version
([#557](#557))
</blockquote>

## `rattler_shell`
<blockquote>

##
[0.19.1](rattler_shell-v0.19.0...rattler_shell-v0.19.1)
- 2024-03-06

### Fixed
- dont use workspace dependencies for local crates
([#546](#546))

### Other
- every crate should have its own version
([#557](#557))
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/MarcoIeni/release-plz/).

Signed-off-by: Bas <4995967+baszalmstra@users.noreply.github.com>
Co-authored-by: Bas <4995967+baszalmstra@users.noreply.github.com>
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.

2 participants