这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@jaimergp
Copy link
Contributor

@jaimergp jaimergp commented Jun 3, 2025

Description

Fixes regression introduced in #14678, and reported in conda-incubator/setup-miniconda#401. conda config --set does not allow aliases to be used, but IMO it should.

Resolves #14899

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?

@jaimergp jaimergp changed the base branch from main to 25.5.x June 3, 2025 11:12
@conda-bot conda-bot added the cla-signed [bot] added once the contributor has signed the CLA label Jun 3, 2025
@github-project-automation github-project-automation bot moved this to 🆕 New in 🔎 Review Jun 3, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Jun 3, 2025

CodSpeed Performance Report

Merging #14898 will not alter performance

Comparing jaimergp:set-aliases (650b613) with 25.5.x (3951a3b)

Summary

✅ 21 untouched benchmarks

@jaimergp jaimergp changed the title Allow aliases to be used in 'conda config --set' Allow aliases to be used in conda config --set and others Jun 3, 2025
@jaimergp jaimergp marked this pull request as ready for review June 3, 2025 13:31
@jaimergp jaimergp requested a review from a team as a code owner June 3, 2025 13:31
@kenodegard
Copy link
Contributor

I think we should include a warning when the key is an alias

More interesting question is if we should use the actual key if an alias is provided (I think most users would want this, some users who use multiple different conda versions would not want this)

@jaimergp
Copy link
Contributor Author

jaimergp commented Jun 3, 2025

More interesting question is if we should use the actual key if an alias is provided

I'm forwarding the alias to the canonical key in all cases. I'll warn on --set because the effects won't be seen immediately on output (for --get, --show, --describe users will see that a different key name was returned).


What I don't fully get is how conda config --add channels ... worked before, given that that field is also an alias 🤔 Is there some special logic for lists and dicts?

@jezdez
Copy link
Member

jezdez commented Jun 3, 2025

More interesting question is if we should use the actual key if an alias is provided

I'm forwarding the alias to the canonical key in all cases. I'll warn on --set because the effects won't be seen immediately on output (for --get, --show, --describe users will see that a different key name was returned).

What I don't fully get is how conda config --add channels ... worked before, given that that field is also an alias 🤔 Is there some special logic for lists and dicts?

Is --add maybe working slightly differently compared to --set?

@jezdez jezdez moved this from 🆕 New to 👀 In Review in 🔎 Review Jun 3, 2025
@jezdez jezdez added this to the 25.5.x milestone Jun 4, 2025
@jezdez jezdez self-assigned this Jun 4, 2025
jezdez added 4 commits June 4, 2025 11:34
…ame_for_alias and update related calls for clarity and consistency.
…ame_for_alias and update related calls. Enhance documentation for name_for_alias method. Improve parameter loading logic in ConfigurationType.
…ynamic parameter mapping and update parameter_names_and_aliases to use it.
)

@property
def parameter_loaders(cls):
Copy link
Contributor

Choose a reason for hiding this comment

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

Move this to the Configuration class itself so we don't have to do self.__class__.parameter_loaders?

Copy link
Member

Choose a reason for hiding this comment

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

Ok

Copy link
Member

@jezdez jezdez Jun 4, 2025

Choose a reason for hiding this comment

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

we need to turn it into a classmethod though then

Copy link
Contributor

@kenodegard kenodegard Jun 4, 2025

Choose a reason for hiding this comment

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

hm we can leave it as a metaclass property but alias it in the instance object?

class ConfigurationType(type):
    @property
    def _parameter_loaders(cls) -> dict[str, ParameterLoader]:
        return {
            name: param
            for name, param in cls.__dict__.items()
            if isinstance(param, ParameterLoader)
        }

    def __call__(cls, *args, **kwargs):
        self = super().__call__(*args, **kwargs)
        self._parameter_loaders = cls._parameter_loaders
        return self

on reflection I think this is getting too far into the weeds and isn't helping with correcting the actual parameter aliasing issue, probably best to revert it to what you originally had?

jezdez added 5 commits June 4, 2025 12:23
…al and update parameter_names_and_aliases in PluginConfig to reflect new parameters.
…method and update related calls in Configuration and PluginConfig. This improves dynamic parameter mapping and ensures consistency in accessing parameter loaders.
…ialization when a file is specified, improving context handling for command-line arguments.
…g classes by replacing calls to parameter_loaders with _parameter_loaders. This change enhances consistency and clarity in parameter management.
@jezdez jezdez requested a review from kenodegard June 4, 2025 16:52
jezdez added 4 commits June 5, 2025 10:22
…asses to directly use class dictionary, improving clarity and consistency in parameter management.
…es by centralizing the logic for setting parameter_names_and_aliases. This improves clarity and consistency in accessing parameter loaders.
@github-project-automation github-project-automation bot moved this from 👀 In Review to ✅ Approved in 🔎 Review Jun 5, 2025
@jezdez jezdez enabled auto-merge (squash) June 5, 2025 10:58
@jezdez jezdez merged commit dc1092c into conda:25.5.x Jun 5, 2025
75 checks passed
@github-project-automation github-project-automation bot moved this from ✅ Approved to 🏁 Done in 🔎 Review Jun 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed [bot] added once the contributor has signed the CLA

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants