Bug#1121404: pylint-django in trixie is broken
Source: pylint-django
Version: 2.0.13-5
Severity: grave
Tags: patch, trixie
Justification: renders package unusable
X-Debbugs-Cc: igo95862@yandex.ru
Hi,
Because of a new astroid package, pylint-django is completely broken on
trixie. See pylint_django/plugin.py:
try:
# pylint: disable=import-outside-toplevel
from pylint_django.augmentations import apply_augmentations
apply_augmentations(linter)
except ImportError:
# probably trying to execute pylint_django when Django isn't installed
# in this case the django-not-installed checker will kick-in
pass
This code is supposed to catch the absence of Django, but also catches
and silences the incorrect import in pylint_django/augmentations/__init__.py:
from astroid.scoped_nodes import ClassDef as ScopedClass, Module
In the astroid version shipped in trixie, this import is supposed to
look like:
from astroid.nodes.scoped_nodes import ClassDef as ScopedClass, Module
This can be tested by running the following:
$ python3 -m pylint_django.augmentations
Traceback (most recent call last):
File "<frozen runpy>", line 189, in _run_module_as_main
File "<frozen runpy>", line 148, in _get_module_details
File "<frozen runpy>", line 112, in _get_module_details
File "/usr/lib/python3/dist-packages/pylint_django/augmentations/__init__.py", line 9, in <module>
from astroid.scoped_nodes import ClassDef as ScopedClass, Module
ModuleNotFoundError: No module named 'astroid.scoped_nodes'
The expected output in the absence of Django:
$ python3 -m pylint_django.augmentations
Traceback (most recent call last):
File "<frozen runpy>", line 189, in _run_module_as_main
File "<frozen runpy>", line 148, in _get_module_details
File "<frozen runpy>", line 112, in _get_module_details
File "/usr/lib/python3/dist-packages/pylint_django/augmentations/__init__.py", line 12, in <module>
from django import VERSION as django_version
ModuleNotFoundError: No module named 'django'
I’m pushing a patch fixing this to the debian/trixie branch in the Git
repository.
--
Cheers,
Andrej
Reply to: