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

Refactor which_package & which_prefix #5041

Merged
merged 14 commits into from
Nov 9, 2023
Merged

Conversation

kenodegard
Copy link
Contributor

@kenodegard kenodegard commented Oct 18, 2023

Description

Consolidate which_package implementations and replaces legacy conda.models.dist.Dist usage with modern conda.models.records.PrefixRecords.

Discovered while working to remove usage of the following:

  • linked_data_no_multichannels
  • linked_data
  • linked
  • is_linked

Depends on #5055

Checklist - did you ...

  • Add a file to the news directory (using the template) for the next release's release notes?
  • Add / update necessary tests?
  • Add / update outdated documentation?

@kenodegard kenodegard self-assigned this Oct 18, 2023
@conda-bot conda-bot added the cla-signed [bot] added once the contributor has signed the CLA label Oct 18, 2023
Comment on lines -53 to -56
if avoid_canonical_channel_name:
fn = linked_data_no_multichannels
else:
fn = linked_data
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

linked_data_no_multichannels and linked_data do the following:

from conda.core.prefix_data import PrefixData
from conda.models.dist import Dist

def linked_data_no_multichannels(prefix):
    return {
        Dist.from_string(prec.fn, channel_override=prec.channel.name): prec
        for prec in PrefixData(prefix).iter_records()
    }


def linked_data(prefix):
    return {
        Dist(prec): prec
        for prec in PrefixData(prefix).iter_records()
    }

since this PR eliminates the poor PrefixRecordDist translation I don't believe there's a need to distinguish between avoid_canonical_channel_name anymore (not that I'm entirely sure what that means in the first place)

@kenodegard kenodegard marked this pull request as ready for review November 6, 2023 20:26
@kenodegard kenodegard requested a review from a team November 6, 2023 20:56
@kenodegard kenodegard merged commit d1b96db into conda:main Nov 9, 2023
24 checks passed
@kenodegard kenodegard deleted the which_package branch November 9, 2023 17:21
@github-actions github-actions bot added the locked [bot] locked due to inactivity label Nov 9, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla-signed [bot] added once the contributor has signed the CLA locked [bot] locked due to inactivity
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants