-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
PR: Pass paths from the Pythonpath manager to the Pylint plugin #21891
base: master
Are you sure you want to change the base?
Conversation
84dc248
to
ed7708b
Compare
c654d8e
to
311e53f
Compare
7dbd860
to
9a07c58
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution @znapy! I think this is really good improvement.
I left several suggestions for you to fix minor code style issues here and there to start with.
In case you haven't used Github reviews before, you can submit all those suggestions in a single commit by adding them to the batch, as described here.
Also, so sorry for not paying attention to your work before. We were busy preparing things for Spyder 6.0 and missed your PR. But we'll try to merge it for 6.1, to be released in a few months. |
Description of Changes
Add the
PYTHONPATH
environment from pythonpath-manager to thepylint
plugin to access the root of the project without packages.Example:
Suppose, you have a project with a single script (for simplicity in a spyder environment):
and you write a test:
In test_do_something.py you access to
import do_something
. So if you start Source -> Run code analysis it will show the error Unable to import 'do_something'. But in the IPython console!pylint tests/test_do_something.py
doesn't show this error because there is PYTHONPATH environment.And you should take additional steps to solve this problem, for example, make a packages:
or fix paths in pylintrc or pyproject.toml (section [tool.pylint], value init-hook=...):
No hacks are needed with this PR - it works out of the box.
Affirmation
By submitting this Pull Request or typing my (user)name below,
I affirm the Developer Certificate of Origin
with respect to all commits and content included in this PR,
and understand I am releasing the same under Spyder's MIT (Expat) license.
I certify the above statement is true and correct: @Znapy