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

Use the builtin plugin classes unless another plugin class is specifically asked for. #2087

Closed
AWhetter opened this issue Apr 7, 2021 · 2 comments · Fixed by #2088
Closed

Comments

@AWhetter
Copy link
Contributor

AWhetter commented Apr 7, 2021

What's the problem this feature will solve?

I have a private plugin for virtualenv where I add an additional discovery class. This discovery class adds a new argument to the command line parser that is required but only when the discovery class is chosen. However I'm seeing an issue where using virtualenv via the command line as normal is now asking for this argument. The reason seems to be that virtualenv is picking a default discovery class but in a non-deterministic way and sometimes the additional discovery class is chosen as the default discovery class and so the argument is required. The default class is chosen depending on which entry point is discovered first. I believe entry points give no guarantees about order of discovery.

The order of entry points discovery seems to change in different installs of virtualenv and the plugin, rather than changing in the same environment between different invocations of virtualenv.

I believe the problem will be the same for creators, seeders, and activators as well.

Describe the solution you'd like

I would expect the builtin discovery class to be chosen as the default discovery class unless explicitly set otherwise.

Alternative Solutions

These classes could have a priority set at the class level. The builtin classes would have a priority set such that a plugin class could opt to set it's priority lower or higher than the builtins. virtualenv would then order these classes by their priority. Classes would be allowed to have the same priority with the understanding that the order of classes with the same priority value would be non-deterministic.

@gaborbernat
Copy link
Contributor

A PR achieving this would be welcomed and reviewed 👍🏻

@AWhetter AWhetter changed the title Use the builtin plugin classes unless anthoer plugin class is specifically asked for. Use the builtin plugin classes unless another plugin class is specifically asked for. Apr 14, 2021
@gaborbernat
Copy link
Contributor

Released via https://pypi.org/project/virtualenv/20.4.4/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants