Skip to content
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

ImportError: cannot import name 'IAstroidChecker' from 'pylint.interfaces' #9144

Closed
hintron opened this issue Oct 12, 2023 · 5 comments
Closed
Labels
Documentation 📗 Downstream Bug 🪲 The problem happens in a lib depending on pylint, not pylint

Comments

@hintron
Copy link

hintron commented Oct 12, 2023

Bug description

I updated to the latest pylint via Poetry (pylint = "*"), and now it crashes for me. Should I downgrade to the latest 2.x until Pylint becomes stable?

Configuration

I'm not sure what is relevant in my config. From pyproject.toml:

[tool.pylint.master]
ignore-paths = ["docs"]

[tool.pylint.main]
# allow 1+ letter names for arguments and variables
# Original regex: [a-z_][a-z0-9_]{2,30}$
# http://pylint-messages.wikidot.com/messages:c0103
argument-rgx = '[a-z_][a-z0-9_]{0,30}$'
variable-rgx = '[a-z_][a-z0-9_]{0,30}$'
const-rgx = '[a-zA-Z_][a-zA-Z0-9_]{0,30}$'
load-plugins = [
  "pylint_pytest",
]

[tool.pylint.messages_control]

[tool.pylint.format]
max-line-length = 88

Command used

pylint

Pylint output

Traceback (most recent call last):
  File "<redacted-poetry-env>/bin/pylint", line 8, in <module>
    sys.exit(run_pylint())
  File "<redacted-poetry-env>/lib/python3.10/site-packages/pylint/__init__.py", line 34, in run_pylint
    PylintRun(argv or sys.argv[1:])
  File "<redacted-poetry-env>/lib/python3.10/site-packages/pylint/lint/run.py", line 162, in __init__
    args = _config_initialization(
  File "<redacted-poetry-env>/lib/python3.10/site-packages/pylint/config/config_initialization.py", line 61, in _config_initialization
    linter.load_plugin_modules(utils._splitstrip(config_data["load-plugins"]))
  File "<redacted-poetry-env>/lib/python3.10/site-packages/pylint/lint/pylinter.py", line 381, in load_plugin_modules
    module.register(self)
  File "<redacted-poetry-env>/lib/python3.10/site-packages/pylint_pytest/__init__.py", line 23, in register
    checker = importlib.import_module(module, package=os.path.basename(dirname))
  File "<redacted-poetry-env>/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<redacted-poetry-env>/lib/python3.10/site-packages/pylint_pytest/checkers/class_attr_loader.py", line 2, in <module>
    from pylint.interfaces import IAstroidChecker
ImportError: cannot import name 'IAstroidChecker' from 'pylint.interfaces' (<redacted-poetry-env>/lib/python3.10/site-packages/pylint/interfaces.py)

Expected behavior

For it to not crash. I thought it worked initially when I upgraded to pylint 3, but now it seems to not work. I have another project set up via Poetry on the same system that works with Pylint 3.0.0/3.0.1, so I'm not sure what is going on, or what I did to mess this project up.

Pylint version

$ pylint --version
pylint 3.0.1
astroid 3.0.0
Python 3.10.13 (main, Sep 11 2023, 13:44:35) [GCC 11.2.0]

OS / Environment

LSB Version:    n/a
Distributor ID: SUSE
Description:    SUSE Linux Enterprise Server 12 SP5
Release:        12.5
Codename:       n/a
@hintron hintron added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Oct 12, 2023
@Pierre-Sassoulas
Copy link
Member

Pierre-Sassoulas commented Oct 12, 2023

This is an issue with pylint-pytest (either it should be upgraded to work with pylint 3.0 or it should tell that it's not compatible with it) following an anticipated breaking change in pylint 3.0 (#8404*). The maintenance status of pylint-pytest is somewhat in limbo for the time being. See PyCQA/meta#56. @stdedos seems to be the most motivated to maintain it in the future so probably that https://github.com/stdedos/pylint-pytest/ with direct install from github will be the most satisfactory solution short term.

Regarding the maintenance status of pylint-pytest we'd need to:

  • See if we / @stdedos can get the pypi credential back to release again (depends on reverbc)
  • Decide if we should migrate from pycka to pylint-dev or make https://github.com/stdedos/pylint-pytest/ the official fork (I don't have the right to maintain the pycqa repo, even if I forked it originally, maybe @DanielNoord does)
  • Decide if we simply create a new name and tell everyone that the plugin is abandoned
  • Decide what we put in the new name (Daniel had an idea for a new incompatible approach, which is not completed atm)

Seeing how many people use the plugin and are affected by the lack of maintenance and seeing that we have a potential maintainer for it, it would be nice to create short term guideline and a long term plan.

(*) Checker should only inherit BaseChecker or any of the other checker types from pylint.checkers. Reporter should only inherit BaseReporter, __implements__ can be removed.

@Pierre-Sassoulas Pierre-Sassoulas added Documentation 📗 Downstream Bug 🪲 The problem happens in a lib depending on pylint, not pylint Needs decision 🔒 Needs a decision before implemention or rejection and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Oct 12, 2023
@stdedos
Copy link
Contributor

stdedos commented Oct 12, 2023

For the sake of visibility (and having everything in one place), I'll comment here:

I'd prefer (permissions-permitting) to maintain the PyCQA fork - so that the "umbrella" of PyCQA exists (even if PyCQA will not maintain it).

My repo can be the official repo, as long as people understand that my maintenance is on best-effort basis only. Same goes with my "maintenance-pledge".

@Pierre-Sassoulas
Copy link
Member

Removing need-decisions label, as @stdedos was able to recover the pypi credentials and decided to move to pylint-dev (https://github.com/pylint-dev/pylint-pytest). I'm not sure there's a lot we can do in term of documentation, the related issues were properly answered already.

@Pierre-Sassoulas Pierre-Sassoulas removed the Needs decision 🔒 Needs a decision before implemention or rejection label Oct 13, 2023
@Pierre-Sassoulas Pierre-Sassoulas added this to the 3.1.0 milestone Oct 13, 2023
@jacobtylerwalls
Copy link
Member

I'm not sure there's a lot we can do in term of documentation, the related issues were properly answered already.

Agreed.

Thanks to @stdedos for stepping up! Let us know if we can help, especially if you find issues that are simpler to fix in core.

@jacobtylerwalls jacobtylerwalls closed this as not planned Won't fix, can't repro, duplicate, stale Oct 13, 2023
@stdedos
Copy link
Contributor

stdedos commented Dec 3, 2023

Hello, participants here :-)

We have fixed pylint-dev/pylint-pytest#12 (aka #9144 i.e., this issue), and there is a planned release for tomorrow morning.

Feel free to git-install (or the official release tomorrow) and test this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation 📗 Downstream Bug 🪲 The problem happens in a lib depending on pylint, not pylint
Projects
None yet
Development

No branches or pull requests

4 participants