Print friendly plugin names, and print both plugins' names for conflicting plugins - #16166
Conversation
Merging this PR will not alter performance
Comparing Footnotes
|
|
The test failures are unrelated; it looks like the tests are getting cancelled for some reason. Thanks! |
| log = logging.getLogger(__name__) | ||
|
|
||
|
|
||
| def _plugin_source(impl_plugin_name: str) -> str: |
There was a problem hiding this comment.
nice followup to the impl.plugin_name work from #15840
there are probably other places adding this distname+version would also be useful (e.g., conda info)
| lines = [] | ||
| for conflict_name, conflicting in sorted(conflict_groups.items()): | ||
| providers = dashlist( | ||
| [_plugin_source(p.impl.plugin_name) for p in conflicting], |
There was a problem hiding this comment.
Let's also sort the list of conflicts:
| [_plugin_source(p.impl.plugin_name) for p in conflicting], | |
| [_plugin_source(p.impl.plugin_name) for p in sorted(conflicting)], |
There was a problem hiding this comment.
Thanks! Noting here that CondaPlugin dataclasses don't have an lt dunder, so I had to do sorted(conflicting, key=lambda p: p.impl.plugin_name) for this, to sort by the string plugin name.
Co-Authored-By: Ken Odegard <4546435+kenodegard@users.noreply.github.com>
Co-Authored-By: Ken Odegard <4546435+kenodegard@users.noreply.github.com>
|
I opened agriyakhetarpal#5 as a concrete sketch for the plugin-manager-method version of this change. |
Co-Authored-By: Ken Odegard <4546435+kenodegard@users.noreply.github.com>
|
I think we might need to harden from conda.base.context import context
from conda.plugins.hookspec import hookimpl
from conda.plugins.types import CondaSolver
from conda.exceptions import PluginError
pm = context.plugin_manager
class IntruderSolver:
@hookimpl
def conda_solvers(self):
yield CondaSolver(name='classic', backend=object)
pm.register(IntruderSolver())
try:
pm.get_hook_results('solvers')
except PluginError as e:
print(str(e))which gets us |
Co-Authored-By: Ken Odegard <4546435+kenodegard@users.noreply.github.com>
|
I opened agriyakhetarpal#6 as a follow-up for the remaining review tweaks: hardening canonical names for registered plugin instances, tightening the conflict-message tests, and clarifying the entry point bookkeeping/news wording. |
Co-Authored-By: Ken Odegard <4546435+kenodegard@users.noreply.github.com>
|
Thanks @kenodegard, makes sense to me! |
Description
In the CI for a project at wntrblm/nox#1095, I recently ran into the following error:
The reason for this is that the CI setup uses conda 25.11.1 with setup-miniconda@v3. That means there is an older version of conda that still implements the signature-verification post_solves hook, and a newer conda-content-trust that does the same. In this scenario,
run_constrained: conda-content-trust >=0.3.0was added only with conda 26.3.After talking to @kenodegard and @jaimergp, we can do two things, which this PR does:
importlib.metadata.packages_distributionsto output friendly plugin names. We fall back to the raw pluggy plugin name in case this isn't possible, which may happen when plugin developers perform editable installations, and they should understand a module path just fine. However, this won't be the case for a majority of plugin users, of course.Therefore, the old output was
- CondaPostSolve(name='signature-verification', action=<...object...>), and the new output should be something along the lines of- 'signature-verification' provided by:split on one line per provider, like this (for example):Checklist - did you ...
newsdirectory (using the template) for the next release's release notes?Add / update outdated documentation?