Skip to content

Conversation

asherf
Copy link

@asherf asherf commented Apr 24, 2021

numversion was removed from pkginfo in pylint:
see: pylint-dev/pylint@fbcb27a#diff-42df8bb8e2d7b0a18f0174dcb5f3c60b1cbca5a394c3c7f8c9b33c99fb6cda99L34

The following error shows up if using latest version of pylint & pylint-django:

File "/home/toolchain/.cache/pants/named_caches/pex_root/venvs/short/90e31a6e/lib/python3.7/site-packages/pylint_django/__init__.py", line 6, in <module>
    from pylint_django import plugin
  File "/home/toolchain/.cache/pants/named_caches/pex_root/venvs/short/90e31a6e/lib/python3.7/site-packages/pylint_django/plugin.py", line 5, in <module>
    from pylint_django.checkers import register_checkers
  File "/home/toolchain/.cache/pants/named_caches/pex_root/venvs/short/90e31a6e/lib/python3.7/site-packages/pylint_django/checkers/__init__.py", line 3, in <module>
    from pylint_django.checkers.models import ModelChecker
  File "/home/toolchain/.cache/pants/named_caches/pex_root/venvs/short/90e31a6e/lib/python3.7/site-packages/pylint_django/checkers/models.py", line 11, in <module>
    from pylint_django.utils import node_is_subclass, PY3
  File "/home/toolchain/.cache/pants/named_caches/pex_root/venvs/short/90e31a6e/lib/python3.7/site-packages/pylint_django/utils.py", line 9, in <module>
    from pylint_django.compat import Uninferable
  File "/home/toolchain/.cache/pants/named_caches/pex_root/venvs/short/90e31a6e/lib/python3.7/site-packages/pylint_django/compat.py", line 28, in <module>
    LOAD_CONFIGURATION_SUPPORTED = pylint.__pkginfo__.numversion >= (2, 3)
AttributeError: module 'pylint.__pkginfo__' has no attribute 'numversion'

Signed-off-by: Asher Foa asher@asherfoa.com

Signed-off-by: Asher Foa <asher@asherfoa.com>
@coveralls
Copy link

coveralls commented Apr 24, 2021

Pull Request Test Coverage Report for Build 1448

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 86.867%

Totals Coverage Status
Change from base Build 1437: 0.0%
Covered Lines: 721
Relevant Lines: 830

💛 - Coveralls

LOAD_CONFIGURATION_SUPPORTED = pylint.__pkginfo__.numversion >= (2, 3)
# pylint before version 2.3 does not support load_configuration() hook.'
# The __pkginfo__.numversion attribute was removed in pylint >= 2.8.0
LOAD_CONFIGURATION_SUPPORTED = pylint.__pkginfo__.numversion >= (2, 3) if hasattr(pylint.__pkginfo__, "numversion") else True

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of defaulting to True it could still perform a version check with pylint.pkginfo.version

From pylint 2.8.0 chages:
__pkginfo__ now only contain __version__ (also accessible with pylint.__version__), other meta-information are still accessible with import importlib;metadata.metadata('pylint').

asherf added 2 commits April 24, 2021 18:26
Signed-off-by: Asher Foa <asher@asherfoa.com>
Signed-off-by: Asher Foa <asher@asherfoa.com>
# pylint before version 2.3 does not support load_configuration() hook.
LOAD_CONFIGURATION_SUPPORTED = pylint.__pkginfo__.numversion >= (2, 3)
# The __pkginfo__.numversion attribute was removed in pylint >= 2.8.0
_pylint_version = pylint.__pkginfo__.version if hasattr(pylint.__pkginfo__, "version") else pylint.__pkginfo__.numversion
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI still failing, not sure why it tries to access numversion. Maybe try pylint.__version__.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants