click-plugins
click-plugins copied to clipboard
Use entrypoint resolve to not check all the dependencies in the env
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
Coverage remained the same at 100.0% when pulling aebc63d4b4bae44247997816a59abdfcf8a86bc6 on cpaulik:entrypoint-resolve into 1f9f53e7befedd7ce04a127a74a8da143495bf08 on click-contrib:master.
@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:
- 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? - 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. - Can you determine if there is a version of Python,
setuptools
, orpkg_resources
where theresolve()
method is not available?
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.
Any updates on if this is worth doing? It is still biting us regularly.
@cpaulik Yeah will try to revisit this weekend.