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

Document how to configure the location of site packages in pylint #9974

Open
paulrougieux opened this issue Sep 26, 2024 · 1 comment · May be fixed by #10111
Open

Document how to configure the location of site packages in pylint #9974

paulrougieux opened this issue Sep 26, 2024 · 1 comment · May be fixed by #10111
Labels
Documentation 📗 Needs PR This issue is accepted, sufficiently specified and now needs an implementation

Comments

@paulrougieux
Copy link

paulrougieux commented Sep 26, 2024

Current problem

The configuration section of the pylint help doesn't explain how to configure the path to the python interpreter and/ or the path to the packages that should be recognised as present by pylint.
https://pylint.pycqa.org/en/latest/user_guide/configuration/index.html

Desired solution

The accepted answer here explains how to define the path to site packages in the pylint configuration
https://stackoverflow.com/a/3065082/2641825

Edit a user's configuration file

vim ~/.pylintrc

The content of the configuration file is as follows:

[pylint]
# Use a virtual environment used for development
init-hook='import sys; sys.path.append("/home/user/python_env/lib/python3.11/site-packages/")'

Adding the path to site packages in the virtual environment is necessary in
order to avoid pylint using the base system version of python, which doesn't
have all packages installed. This avoids reporting package not installed errors.

Additional context

No response

@paulrougieux paulrougieux added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Sep 26, 2024
@DanielNoord DanielNoord added Documentation 📗 Needs PR This issue is accepted, sufficiently specified and now needs an implementation and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Oct 1, 2024
@JessJohn0
Copy link

I am working on adding documentation for init-hook to that page, including an example for appending an alternate module dir to sys.path. Will submit a PR soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation 📗 Needs PR This issue is accepted, sufficiently specified and now needs an implementation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants