-
Notifications
You must be signed in to change notification settings - Fork 117
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
Plugin appears to broken by astroid 2.9.1 #343
Comments
I have the same problem. Downgrading to 2.11 fixes it. |
With my repro, the problem can be fixed just by downgrading to I'm unsure whether the actual problem here is in It was quite difficult to debug this, as there were no error messages, just a silent failure to behave as expected. Fortunately I had a working project available, and I was able to start with the simple repro and downgrade dependencies one-by-one to match that project until I pinpointed that the problem was with Also fortunately, |
I should probably have also explicitly said that 2.9.1 is the latest version of So if people try to install |
The problem might be in astroid, in the When In Astroid version 2.9.1, the >>> from astroid.scoped_nodes import ClassDef
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/fred/.venvs/ultron/lib/python3.9/site-packages/astroid/scoped_nodes.py", line 5, in <module>
from astroid.nodes.scoped_nodes import (
ImportError: cannot import name '_is_metaclass' from 'astroid.nodes.scoped_nodes' (/home/fred/.venvs/ultron/lib/python3.9/site-packages/astroid/nodes/scoped_nodes/__init__.py) There might have been a change on this module between v2.9.0 and v2.9.1. (I'll continue later this afternoon). |
There is a deprecation warning that |
@GrimBox can you try with the code on this branch https://github.com/PyCQA/pylint-django/tree/343-astroid-2.9.1-compat That seems to fix things - at least the tests are passing. (except the code formatting one I will fix that ;-) ) |
I tested it with the repro repository, it works too so I will finish up some other bugs/PRs and get a release with the fix in. Thanks for the awesome repro steps @amdw! |
@carlio Yes, it works for me too 👍 Thanks ! |
Cool! So version |
Many thanks for the rapid fix! I guess there are two things that surprise me about this bug: (1) upgrading from 2.9.0 to 2.9.1 of a dependency - just a single bugfix version - caused breakage, and (2) depending on a nonexistent class in that dependency did not cause any clear exception or error messages related to that problem, it just caused incorrect lint errors to be reported. I guess (1) is more of a problem with |
I think that (1) is just a backwards-incompatible fix being missed in PR review. All in all, this fix was something that needed to be done anyway in pylint-django, it just accelerated a bit! Regarding (2) - the tests did reveal this problem. Only last week was this repo moved to using github actions (RIP travis!) and the test coverage already checks against latest As for why it was not more obvious or throwing an exception, I don't really know to be honest. The tests showed a problem because test output was unexpected, but not due to being unable to import |
Just chipping in here to say that this was indeed a mistake in review and from me when moving these files. There was no intention of deprecating anything in that move. I simply didn't check the imports well enough. Sorry about any trouble caused, we're discussing how to resolve this in pylint-dev/astroid#1325 and I hope to release a new version of |
No worries @DanielNoord , it was something I knew about for a while (see #339) I had just been a bit lazy about doing anything about it :-) |
hi, i seem to have this closed issue haunting me... running
pylint-django version (per Pipfile.lock): 2.5.3 behaviour seems to be inconsistent; i can run the command in at least three ways—A) Dockerized Gitlab runner; B) local Docker container; C) local bare metal; and it fails on A and C but not on B. per the source, the import statement appears to rely on an implicit reexport: from astroid.scoped_nodes import (
Module,
GeneratorExp,
Lambda,
DictComp,
ListComp,
SetComp,
FunctionDef,
ClassDef,
AsyncFunctionDef,
) maybe this is the issue. still researching but wanted to log it. UPDATE: it turns out i can fix this by updating pylint itself, from 2.6.0 to 2.13.7. not quite sure why it was working in my local Docker container. probably just an issue with lockfile. |
This is still failing in a Can someone please confirm a known list of package versions that do work together for :
(ideally in a miniconda environment) |
@gamesbook I have no experience with I'm not sure what the process is by you should probably look into asking the maintainers for the Anaconda repositories to upload a new version to their package index. |
With
astroid
2.9.1,pylint-django
appears not to work correctly.For example, it produces errors like
Class 'MyModel' has no 'objects' member (no-member)
, even when it should be able to infer that theobjects
member exists.Full repro steps, including
Pipenv.lock
file with precise package versions, is available in the following repo:https://github.com/amdw/pylint-django-repro
The text was updated successfully, but these errors were encountered: