click-plugins icon indicating copy to clipboard operation
click-plugins copied to clipboard

Use entrypoint resolve to not check all the dependencies in the env

Open cpaulik opened this issue 4 years ago • 5 comments

I can adapt the tests etc. If you agree that this is a workable way and if this issue is indeed a problem you don't want to see.

Fix #31

cpaulik avatar Feb 20 '20 15:02 cpaulik

Coverage Status

Coverage remained the same at 100.0% when pulling aebc63d4b4bae44247997816a59abdfcf8a86bc6 on cpaulik:entrypoint-resolve into 1f9f53e7befedd7ce04a127a74a8da143495bf08 on click-contrib:master.

coveralls avatar Feb 20 '20 15:02 coveralls

@cpaulik A cursory look at the docs for EntryPoint.load() and EntryPoint.resolve() suggest this would work, but I would like a better understanding of what currently happens and the intended changes in this PR.

A few questions:

  1. Can you provide a set of requirements that would put a Python virtual environment in this state so that I can compare behavior on master to this branch?
  2. You provided a partial traceback in #31. Can you describe in more detail what happens and why the behavior should change? It seems like a plugin with a dependency problem is immediately raising an exception instead of appearing as a broken plugin, which at least lest the rest of the CLI work? I would think the try/except would be broad enough to keep things working as intended.
  3. Can you determine if there is a version of Python, setuptools, or pkg_resources where the resolve() method is not available?

geowurster avatar Feb 25 '20 23:02 geowurster

1. Can you provide a set of requirements that would put a Python virtual environment in this state so that I can compare behavior on `master` to this branch?

At the moment this is as simple as

pip install docutils==0.16 botocore

You should get the warning

ERROR: botocore 1.15.7 has requirement docutils<0.16,>=0.10, but you'll have docutils 0.16 which is incompatible.

at the end of the installation.

2. You provided a partial traceback in #31. Can you describe in more detail what happens and why the behavior should change? It seems like a plugin with a dependency problem is immediately raising an exception instead of appearing as a [broken plugin](https://github.com/click-contrib/click-plugins#broken-and-incompatible-plugins), which at least lest the rest of the CLI work? I would think the `try/except` would be broad enough to keep things working as intended.

The problem in my view is that this breaks perfectly working plugins. If pip can not resolve the environment correctly a dependency of a dependency might be wrong. This can happen quite often in complex projects because of the shortcomings of pip. The current behavior means that the plugin does not work at all even if the plugin does not use any of the features of the dependency of the dependency and will work perfectly. So my suggestion is to replace the error by a warning that not all dependencies are correctly installed. Similar to what pip does at the moment. This warning would still need to be implemented in this PR.

3. Can you determine if there is a version of Python, `setuptools`, or `pkg_resources` where the `resolve()` method is not available?

I can do that if we agree that this is a problem that needs fixing.

cpaulik avatar Feb 26 '20 10:02 cpaulik

Any updates on if this is worth doing? It is still biting us regularly.

cpaulik avatar Apr 28 '20 10:04 cpaulik

@cpaulik Yeah will try to revisit this weekend.

geowurster avatar May 01 '20 00:05 geowurster