Modern Python Projects Transcripts
Chapter: Python versions and packages
Lecture: pipx packages in VS Code
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
Do you remember, how we were setting up VSCode in the previous chapter? And after we installed Python extension VSCode asked us if we want to install
0:10
the pylint linter. At that time we chose, Yes, but normally I don't like to do this.
0:16
I don't like to install packages that way because VSCode will install it somewhere But usually I don't know where.
0:24
So, I prefer to install packages myself and then point VSCode to use those packages. Now that we're using pipx to manage our global Python packages,
0:34
we can tell VSCode to use those pipx packages. All we need to do is to install pylint with pipx and then find a
0:40
path to this pylint binary. So let's go to the terminal. As you can see, I have already installed pylint, so I can run which pylint
0:52
and this should give me the path to the pylint binary. So, I take that. I go back to VSCode and I go
1:03
to the settings. I don't remember what's the setting name. So, let's search for pylint path and that should be it.
1:12
Yeah, so you can see there is section for Python linting and you can specify paths to different linters. Here's pylint.
1:21
So, instead of using pylint command, I want to explicitly use the pylint from pipx. We change this, we save our settings and we quit.
1:30
So, let's see if pylint will actually work. Now let's make some mistakes. Let's enable linting and nothing happened.
1:49
So, let's run linting actually, still nothing happened. I'm running out of options here, Okay, so let's actually select the linter.
2:00
So, as you can see, we have the undefined variable surname and this error comes
2:04
from pylint . I was actually expecting it to complain about having unused variable and importing a module and not using it,
2:12
but maybe it requires some additional configuration. Nevertheless, this is how you can use VSCode with packages installed with pip.
2:19
All we have to do is to find the appropriate setting. In my case, it was path to the pylint binary,
2:26
but it could be a path to some other binaries. And then you have to change the setting to point to the package from pipx.