You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While adding plugins support for molecule I discovered that if by any chance one plugins would encounter a VersionConflict, the entire iteration fails suddenly without giving me any chance to ignore the potentially broken plugin.
In this case alone the conflict was caused by azure-cli and it was benign by itself. As you can imagine an application developer has zero control over what happens with the plugins and one broken plugin should not affect the loading of others.
import pkg_resources
for f in pkg_resources.iter_entry_points('molecule_driver'):
print(f)
The code above should never raise exceptions. In my case iteration stops after first plugin, as the second one happens to be the one in conflict.
Traceback (most recent call last):
File "/Users/ssbarnea/.pyenv/versions/3.6.8/bin/molecule", line 11, in <module>
load_entry_point('molecule', 'console_scripts', 'molecule')()
File "/Users/ssbarnea/.pyenv/versions/3.6.8/lib/python3.6/site-packages/pkg_resources/__init__.py", line 489, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/Users/ssbarnea/.pyenv/versions/3.6.8/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2843, in load_entry_point
return ep.load()
File "/Users/ssbarnea/.pyenv/versions/3.6.8/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2434, in load
return self.resolve()
File "/Users/ssbarnea/.pyenv/versions/3.6.8/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2440, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/Users/ssbarnea/os/molecule/molecule/__main__.py", line 21, in <module>
from .shell import main
File "/Users/ssbarnea/os/molecule/molecule/shell.py", line 28, in <module>
from molecule import command
File "/Users/ssbarnea/os/molecule/molecule/command/__init__.py", line 29, in <module>
from molecule.command import create # noqa
File "/Users/ssbarnea/os/molecule/molecule/command/create.py", line 108, in <module>
type=click.Choice(molecule_drivers()),
File "/Users/ssbarnea/os/molecule/molecule/api.py", line 15, in molecule_drivers
for entry_point in pkg_resources.iter_entry_points('molecule_driver')
File "/Users/ssbarnea/os/molecule/molecule/api.py", line 15, in <dictcomp>
for entry_point in pkg_resources.iter_entry_points('molecule_driver')
File "/Users/ssbarnea/.pyenv/versions/3.6.8/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2433, in load
self.require(*args, **kwargs)
File "/Users/ssbarnea/.pyenv/versions/3.6.8/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2456, in require
items = working_set.resolve(reqs, env, installer, extras=self.extras)
File "/Users/ssbarnea/.pyenv/versions/3.6.8/lib/python3.6/site-packages/pkg_resources/__init__.py", line 791, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (azure-mgmt-storage 4.0.0 (/Users/ssbarnea/.pyenv/versions/3.6.8/lib/python3.6/site-packages), Requirement.parse('azure-mgmt-storage~=2.0'), {'azure-mgmt'})
The text was updated successfully, but these errors were encountered:
Hi Sorin. What happens if you use the importlib_metadata or entrypoints projects? Those projects aim to replace pkg_resources and in particular behaviors like these. If importlib_metadata doesn’t suit your needs, please file a bug with Python or importlib_metadata, so we might be able to consider supporting it there.
While adding plugins support for molecule I discovered that if by any chance one plugins would encounter a VersionConflict, the entire iteration fails suddenly without giving me any chance to ignore the potentially broken plugin.
In this case alone the conflict was caused by azure-cli and it was benign by itself. As you can imagine an application developer has zero control over what happens with the plugins and one broken plugin should not affect the loading of others.
The code above should never raise exceptions. In my case iteration stops after first plugin, as the second one happens to be the one in conflict.
The text was updated successfully, but these errors were encountered: