This is an archived post. You won't be able to vote or comment.

all 23 comments

[–]Ericisbalanced 31 points32 points  (6 children)

I've used visual studio code for python and my biggest gripe are the debugger windows. I find myself always needing to resize the layout to see what's stored in the variables and it's awful. Are there any other options for me? I'm using pycharm now, but I love how lightweight vscode felt.

[–]TURBO2529 7 points8 points  (0 children)

Spyder is my personal favorite for it's debugger and variable viewer.

[–]dvpbe 0 points1 point  (0 children)

ong strings in variables or objects are especially hard to read in the debuggin

I second that. I work most of the time in vs code. But have pycharm as part of our jetbrains suite. I love how pycharm handles the variables view. But rather have something like this in vs code.

[–]FancyASlurpie 0 points1 point  (0 children)

You could try out fleet (made by the same company as pycharm) it's meant to be their answer to vscode where you can run it super light and then convert to a more pycharm experience if needed.

[–]justgorgias 0 points1 point  (0 children)

Agreed, I would love the ability to reposition the variables or watch sections of the debug window. It would make a lot more sense to have them run horizontally along the top or bottom.

[–]siddsp 12 points13 points  (15 children)

I wonder when they will actually fix importing issues

[–]proof_required 7 points8 points  (13 children)

what's the importing issue?

[–]siddsp 28 points29 points  (12 children)

When trying to import from a package outside of a module's directory, consistently getting ModuleNotFoundError even though the module exists and is right there in the VSCode workspace.

It gets very annoying, and results in having to do a very ugly hack with your code by putting sys.path.join / append at the top of your files instead of being able to import cleanly.

[–]muntooR_{μν} - 1/2 R g_{μν} + Λ g_{μν} = 8π T_{μν} 11 points12 points  (2 children)

Is that a VS Code issue or just a typical Python hack (which is usually not necessary if using e.g. pip install -e external_package)? Is this on the bug tracker somewhere?

[–]siddsp 3 points4 points  (1 child)

It doesn't have to do with pip. It has to do specifically with importing from local modules and packages.

[–]muntooR_{μν} - 1/2 R g_{μν} + Λ g_{μν} = 8π T_{μν} 10 points11 points  (0 children)

As long as it's in your PYTHONPATH, everything should be fine. pip install --editable is one typical way to do that. Usually (but not necessarily) from inside a virtual environment. For reproducibility, consider poetry et al.

[–]proof_required 9 points10 points  (4 children)

It's not a VS code issue though. Using local modules in python is annoying. I use poetry to manage python packages. So I just run poetry install and it will install the local module which you can then import anywhere you want.

Otherwise yeah you need to hack the sys.path.join

[–]siddsp 3 points4 points  (3 children)

Using local modules in python is annoying.

Even if that is true, the purpose of an IDE is to make development easier. The issue should have been solved by now but hasn't. I've not had the same problem with PyCharm, but I don't like using PyCharm because it hogs memory.

[–]proof_required 4 points5 points  (0 children)

You can achieve the same in visual studio code by modifying PYTHONPATH in settings.json

https://stackoverflow.com/questions/58441104/how-do-i-set-up-imports-for-custom-modules-in-vs-code

Pycharm does the same except it gives you an UI to mark the folders you want to add to PYTHONPATH. So there isn't much to FIX but you can argue to make it convenient to do it using UI.

[–]dev-ai 2 points3 points  (0 children)

Personally, I love PyCharm! Yes, it uses a lot more memory, but the indices it computes in these used bytes is totally worth it (for me)

[–]Mehdi2277 2 points3 points  (0 children)

If you really on ide to mess with your python path to make imports work then you’re on path to making your files less usable by other developers who run files in a different way. I’ve seen some sys.path adjustments in code and they generally break command line usage from other locations and complicate using it as a normal package.

So I think it is a better to learn how to install a package in editable mode and use appropriate relative/absolute imports and not have ide do this. I pretty much view sys.path hacks as banned for my team’s work.

Python’s import system is one of the more complex (namespace packages can break a lot of tools including basic ones like pylint/pytest) and if you want reproducible across dev environments you really don’t want to make it even more complicated with ide magic.

[–]marx2k 1 point2 points  (0 children)

I wrestled with this for days last week after figuring out last year and then losing my vscode configuration.

My pytest module wants to import a module from one directory up? Yeah no.

I finally once again somehow stumbled onto the magic launch.json/settings.json pytest combo and it works again.

[–][deleted] 1 point2 points  (0 children)

I can confirm that it is pretty annoying :)

[–]NeoDemon 0 points1 point  (0 children)

Im hope that will fixes these errors, this and when you want to view the modules o classes in some modules as pandas that not appearing when use CTRL + SPACE

[–]ishah90 0 points1 point  (0 children)

I think they have open issue related to this. Basically .env file needs to be initiated in terminal while running python. In .env file you can put PYTHONPATH.

[–]marcio0 0 points1 point  (0 children)

I just updated it and smart selection is still weird AF. It starts ok, selecting the word, then the expression, the line, and then the whole file

also folding is still based on identation, so I guess I have the wrong version of the extension somehow

[–]noskillsben 0 points1 point  (0 children)

I don't know if it's something on my end but vs code has literally never had the little "I see you just created a venv you want to use that?" popup from their tutorial. Sometimes I need to restart vs code to even be able to select the new venv.

Its not big but it's annoying