-
-
Notifications
You must be signed in to change notification settings - Fork 310
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
Plugins with conflicting entry-point error-code specifications do not auto-load properly #1090
Comments
In GitLab by @asottile on Apr 14, 2019, 23:06 yeah not sure if this is documented anywhere but the name has to be unique. The oddity with uninstall / upgrade / ordering is due to setuptools metadata being stored on the filesystem and so you have (~relatively undefined) ordering based on inode. I think this is working as intended right now, though it would maybe be better if some sort of warning / error occurred in this case. This is probably the most relevant line: https://gitlab.com/pycqa/flake8/blob/98beabdcc50ee352a8a5eded1009b0914a3645b9/src/flake8/plugins/manager.py#L276 |
In GitLab by @bskinn on Apr 14, 2019, 23:27 @asottile To be sure I understand you, is it that the And, regardless, yeah, it seems like at minimum a warning should be emitted at execution time for plugin namespace collisions like this. |
In GitLab by @asottile on Apr 14, 2019, 23:34 Actually yeah, now that I found the right docs page (I was looking at the using plugins page earlier!) it does seem to be prominently called out twice there: http://flake8.pycqa.org/en/latest/plugin-development/registering-plugins.html
This was part of the rationale for moving to allowing 3-letter codes in flake8 3.x And yeah, upgrading / downgrading a package likely changes the inode ordering (try running |
In GitLab by @bskinn on Apr 14, 2019, 23:43 Unngh... So... This... collision behavior is intentional?
This seems like a problematically fragile semantics. Is the idea that this would avoid plugins reporting the same error codes? It...seems like a really awkward/incomplete/problematic approach, if so. IMO the entry point name should be, e.g., the package name...MUCH more likely to be unique. If there's a desire to have some sort of machinery in place to avoid multiple things raising the same code, it would make more sense to me for plugins to register the codes they raise via some other parameter in the plugin registration handshake...then it'd be fully granular. |
In GitLab by @bskinn on Apr 14, 2019, 23:44 And <nod>, I have noticed that |
In GitLab by @asottile on Apr 14, 2019, 23:48 It's not so simple unfortunately -- that prefix is used by I'm not sure that the behaviour is ~intentional so-to-speak, though it is at least known and documented. Ideally plugins would select unique reported error codes, though there isn't really any sort of centralized place to manage that (even if there was, that'd box out proprietary / closed-source plugins). |
In GitLab by @bskinn on Apr 14, 2019, 23:56 Hrmmmm...so, the recommended best-practice is for plugin developers to switch to the multi-letter code prefixes? If so, a marketing push to try to coax devs of existing plugins to make that switch might be of some value...counterweighted by the users of the plugins potentially needing to update their configs, I guess. And...as a user, I guess I just have to manually check every time I install a new plugin, that all of the plugins I expect do still show up on a |
In GitLab by @asottile on Apr 14, 2019, 23:58 I think it's more that new plugins should pick the three-letter codes, assuming there aren't existing conflicts |
In GitLab by @bskinn on Apr 15, 2019, 24:00 closed |
In GitLab by @bskinn on Apr 15, 2019, 24:04 <nod>, makes sense. In this case, which project would you recommend I approach first to switch codes, and avoid the collision? -pie is smaller and non-PyCQA, and so seems the more natural one to displace, but -bugbear might be more responsive, being PyCQA? |
In GitLab by @bskinn on Apr 15, 2019, 24:16 Hehe, Good luck with that PR...man, soooo many complex cases to consider...! |
In GitLab by @bskinn on Apr 14, 2019, 22:32
My apologies if this has been reported before, or is a known limitation; I didn't find anything similar after searching the issues for a while.
Please describe how you installed Flake8
Please provide the exact, unmodified output of
flake8 --bug-report
Please describe the problem or feature
First, the following annotated snip of
pip list
:Note that both
flake8-bugbear
andflake8-pie
are installed in the venv.Second, the output of
flake8 --version
:EXPECT: Both
flake8-bugbear
andflake8-pie
would show inflake8 --bug-report
andflake8 --version
.ACTUAL:
flake8-pie
shows in both, butflake8-bugbear
shows in neither.It appears that flake8 plugins with identical error-code specifications in
setup(entry_points=...)
collide with one another, and only one ends up loaded by flake8.From
setup.py
offlake8-bugbear
@ currentmaster
:From
env/lib/.../entry-points.txt
offlake8-pie
v0.0.4, after install from PyPI (there are some odd discrepancies between the GitHub repo and the packages on PyPI):Both plugins declare just
B
as their associated error code/code-category.Weirdly, if I upgrade
flake8-pie
to v0.1.0 in the venv (pip install -U flake8-pie==0.1.0
), it's nowflake8-pie
that fails to be loaded, whereasflake8-bugbear
loads fine:The contents of
env/lib/.../entry_points.txt
forflake8-pie==0.1.0
are identical to that for0.0.4
, above.With
flake8-pie==0.1.0
installed, such thatflake8-bugbear
auto-loads butflake8-pie
doesn't, I can get both plugins to load if I declareflake8-pie
manually intox.ini
:As follows:
For completeness:
Curiously,
flake8-pie
doesn't show asis_local
, despite it being loaded due to the specification in[flake8:local-plugins]
.The text was updated successfully, but these errors were encountered: