josean-dev / dev-environment-files

2.98k stars 800 forks source link

pylint via mason nuances result in import errors when using poetry and pyenv #59

Open Eptarch opened 5 months ago

Eptarch commented 5 months ago

Hey, thanks for the great tutorials and setup guide for neovim!

In your latest guide, you add pylint into mason.lua file and then you specify it in linting.lua for python files.

The thing is, Mason installs pylint into its own virtualenv with different site-packages, and I fail to find a way to reliably configure it for different projects.

I use poetry and pyenv for juggling versions and environments, and even if I activate virtualenv by runninng poetry shell it won't pick up site-packages, since they're in another virtualenv that differs from the one I use in a project.

Related bit of how to configure pylint in nvim-lint: here Related bit about different envs when installed via Mason: here Related SO question on how to set --init-hook for pylinlt for a single static virtualenv: here

This possibly could be circumvented by installing pylint globally, but I haven't tested it yet, and I'd still better have it installed by Mason and configured within linting.lua. Another option is to remove pylint from ensure_installed in mason.lua and from linting.lua

If you have any additional info on this, that'd be rad to read.

Cheers!