DEV Community

Discussion on: My Top 10 Visual Studio Code Extensions for Python in 2020

Collapse
 
michaelcurrin profile image
Michael Currin

For interest, Pylance is a newer alternate to the MS Python one. Pylance is meant to be smarter but doesn't support everything the same like it broke trying to parse a module import which worked fine on the old extension so I ditched Pylance

Collapse
 
sshine profile image
Simon Shine

I came to this blog post exactly because I experienced problems with Pylance and virtualenv. My project lives in a sandbox, and it seems that Pylance can't see that from the environment variables available when VSCode was launched.

Collapse
 
michaelcurrin profile image
Michael Currin • Edited

You may get some use of my .env file and settings.json file here.

github.com/MichaelCurrin/py-projec...

They were setup for MS Python to use a virtual env. The .env also includes a reference to a main package so that imports within the project work

Pylance might use another approach which hopefully is covered in its docs

Thread Thread
 
sshine profile image
Simon Shine

Thanks. I'll keep that in mind if I need to scale something using Python. :)

If I use the other Python extension for VSCode, it detects dependencies nicely. I only tried Pylance because a VSCode pop-up recommended it as a better alternative, which it turned out not to be on all accounts.

Thread Thread
 
michaelcurrin profile image
Michael Currin

There's things I miss in VS Code that you get in PyCharm. Like builtin intellisense, debugging and refactoring support. No extensions needed.

And it can run Linting with its own linter. VS Code makes you install a linter inside your virtual env otherwise the lint options in the editor don't work.

VS Code does support templating better like for mixing HTML and JS and Liquid a single Flask jinja file. And VS Code has better support for JS files

Thread Thread
 
sshine profile image
Simon Shine

I simply prefer not to have to change my editor every time I change programming language. The moment PyCharm gets good LSP support for Scala and Haskell, I’ll consider it. ;)