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?
0:04 And after we installed Python extension VSCode asked us if we want to install
0:09 the pylint linter. At that time we chose,
0:12 Yes, but normally I don't like to do this.
0:15 I don't like to install packages that way because VSCode will install it somewhere
0:19 But usually I don't know where.
0:23 So, I prefer to install packages myself and then point VSCode to use those
0:27 packages. Now that we're using pipx to manage our global python packages,
0:33 we can tell VSCode to use those pipx packages.
0:36 All we need to do is to install pylint with pipx and then find a
0:39 path to this pylint binary. So let's go to the terminal.
0:47 As you can see, I have already installed pylint, so I can run which pylint
0:51 and this should give me the path to the pylint
0:56 binary. So, I take that. I go back to VSCode and I go
1:02 to the settings. I don't remember what's the setting name.
1:05 So, let's search for pylint path and that should be it.
1:11 Yeah, so you can see there is section for python linting and you can specify
1:15 paths to different linters. Here's pylint.
1:20 So, instead of using pylint command,
1:22 I want to explicitly use the pylint from pipx.
1:26 We change this, we save our settings and we quit.
1:29 So, let's see if pylint will actually work.
1:31 Now let's make some mistakes. Let's enable linting and nothing happened.
1:48 So, let's run linting actually,
1:51 still nothing happened. I'm running out of options here,
1:55 Okay, so let's actually select the linter.
1:59 So, as you can see, we have the undefined variable surname and this error comes
2:03 from pylint . I was actually expecting it to complain about having unused variable and importing
2:09 a module and not using it,
2:11 but maybe it requires some additional configuration.
2:13 Nevertheless, this is how you can use VSCode with packages installed with pip.
2:18 All we have to do is to find the appropriate setting.
2:22 In my case, it was path to the pylint binary,
2:25 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.