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

Support latest pylint, pylint-django #393

Closed
ajhodges opened this issue Jul 28, 2020 · 12 comments
Closed

Support latest pylint, pylint-django #393

ajhodges opened this issue Jul 28, 2020 · 12 comments

Comments

@ajhodges
Copy link
Contributor

The latest published version of pylint is 2.5.3, and the latest pylint-django is 2.2.0.

I'm specifically interested in pylint-django 2.2.0 due to the rework of how string FK references are handled.

@chocoelho
Copy link
Contributor

Hey there, just tagged 1.3.1.dev0 containing this change. Will still upload it to Pypi later.

@ajhodges
Copy link
Contributor Author

Just FYI - it might make sense to move to pylint-django 2.3.0, as pylint-dev/pylint-django#277 in 2.2.0 seems to have caused a lot of user confusion.

@carlio
Copy link
Member

carlio commented Aug 22, 2020

@chocoelho as @ajhodges says , there was a breaking change made in pylint-django 2.2.0 which is still in 2.3.0 actually.

A new checker was added to be able to infer the types of model fields even if they were defined as a ForeignKey referencing a string. This type lookup required Django to be configured enough to start, or it'll throw an ImproperlyConfigured exception. It's a bit of an unfortunate side effect of adding a good new feature, and a good default way to handle it is still being discussed for pylint-django.

For prospector, I'd suggest either not upgrading just yet, or my preferred option, adding something to the pylint tool that will automagically configure Django with some very basic defaults. Since prospector was designed to be the 'make things easy and avoid gotchas' tool, I like the second approach.

So for now, if you want to do a release, stick to pylint-diango<2.2.0 and I'll try to separately create a PR for the 'default Django settings' approach that can go into the next release (or this if I get it done in time :-) )

@chocoelho
Copy link
Contributor

Got it @carlio. I'll take a look at it later today. I'm fond of these dev releases as it allows us to check for issues like these and give others a chance to report cases we didn't check for yet. This way, once we release a stable version it'll be really stable and we won't face the issues we had with 1.1.6.x. I feel like we can rollback for now to go with the vulture fix and then do these pylint changes calmly.

@chocoelho
Copy link
Contributor

@carlio @ajhodges 1.3.1.dev1 released in the meanwhile, this pre-release pins pylint-django<2.2.0

@djbrown
Copy link

djbrown commented Oct 29, 2020

@chocoelho any news on this?

I get conflict when installing via pipenv or poetry:

  SolverProblemError

  Because no versions of prospector match >1.3.1,<2.0.0
   and prospector (1.3.1) depends on pylint-django (<2.2.0), prospector (>=1.3.1,<2.0.0) requires pylint-django (<2.2.0).
  So, because riddlebase depends on both pylint-django (^2.3.0) and prospector (^1.3.1), version solving failed.```

@chocoelho
Copy link
Contributor

I should tackle it in the next couple of days, as it seems the issue that blocked any advance in here for solved in pylint.

@ipaleka
Copy link

ipaleka commented Nov 3, 2020

Pip brings complaints (--use-feature=2020-resolver note on installing) with Python 3.9.0, pylint 2.5.3 and the latest pylint-django 2.3.0, but everything works fine.

But, the following is the traceback I get after installing pylint 2.6.0:

$ prospector
Traceback (most recent call last):
  File "/home/ipaleka/dev/venvs/myproject/bin/prospector", line 8, in <module>
    sys.exit(main())
  File "/home/ipaleka/dev/venvs/myproject/lib/python3.9/site-packages/prospector/run.py", line 167, in main
    prospector.execute()
  File "/home/ipaleka/dev/venvs/myproject/lib/python3.9/site-packages/prospector/run.py", line 54, in execute
    for tool in self.config.get_tools(found_files):
  File "/home/ipaleka/dev/venvs/myproject/lib/python3.9/site-packages/prospector/config/__init__.py", line 42, in get_tools
    config_result = tool.configure(self, found_files)
  File "/home/ipaleka/dev/venvs/myproject/lib/python3.9/site-packages/prospector/tools/pylint/__init__.py", line 127, in configure
    config_messages, configured_by = self._get_pylint_configuration(
  File "/home/ipaleka/dev/venvs/myproject/lib/python3.9/site-packages/prospector/tools/pylint/__init__.py", line 218, in _get_pylint_configuration
    config_messages = self._prospector_configure(prospector_config, linter)
  File "/home/ipaleka/dev/venvs/myproject/lib/python3.9/site-packages/prospector/tools/pylint/__init__.py", line 82, in _prospector_configure
    linter.disable("mixed-indentation")
  File "/home/ipaleka/dev/venvs/myproject/lib/python3.9/site-packages/pylint/message/message_handler_mix_in.py", line 67, in disable
    self._set_msg_status(
  File "/home/ipaleka/dev/venvs/myproject/lib/python3.9/site-packages/pylint/message/message_handler_mix_in.py", line 118, in _set_msg_status
    message_definitions = self.msgs_store.get_message_definitions(msgid)
  File "/home/ipaleka/dev/venvs/myproject/lib/python3.9/site-packages/pylint/message/message_definition_store.py", line 57, in get_message_definitions
    for m in self.message_id_store.get_active_msgids(msgid_or_symbol)
  File "/home/ipaleka/dev/venvs/myproject/lib/python3.9/site-packages/pylint/message/message_id_store.py", line 120, in get_active_msgids
    raise UnknownMessageError(error_msg)
pylint.exceptions.UnknownMessageError: No such message id or symbol 'mixed-indentation'.

@aidar-ms
Copy link

aidar-ms commented Jan 8, 2021

@chocoelho any updates on this? I think pylint-django 2.1.0 raises an error if a project uses string notation for Django FK ("app_model.Model"), which I think has been addressed in the latest versions.

@adamcunnington
Copy link

Hi, pylint supported isort 5 but I am still stuck on an outrageously old version of isort (almost 24 months old) because prospector is only supporting pylint 2.5.3. This means that I am stuck on isort 4.3 whilst 5.7 is currently stable.

What is the ETA please for prospector updating to a version of pylint that supports isort 5?

@Alchemy-Meister
Copy link

Alchemy-Meister commented Mar 30, 2021

Tried upgrading astroid and pylint to latest version as today: 2.5.2 and 2.7.4 respectively. I ran into the same error as @ipaleka with the pylint.exceptions.UnknownMessageError: No such message id or symbol 'mixed-indentation'. exception.

Having read some issues on pylint repo I found that mixed-indentation message has been removed from the pylint codebase, as mentioned in pylint-dev/pylint#3512 and merged in pylint-dev/pylint#3578.

I found that prospector explicitly disabled this message and by removing the following line I was able to run prospector on the aforementioned pylint version with Python 3.9.2.

alex-rozenshteyn-leapyear added a commit to alex-rozenshteyn-leapyear/prospector that referenced this issue Aug 17, 2021
@Pierre-Sassoulas
Copy link
Collaborator

This is fixed in 1.4.0.

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

No branches or pull requests

9 participants