:mega::vscode: Kedro VSCode extension 0.0.3 is out...
# announcements
n
📣vscode Kedro VSCode extension 0.0.3 is out. ‱ Added config preview for datasets when hovered. Download: https://marketplace.visualstudio.com/items?itemName=kedro.Kedro
K 2
vscode 6
đŸ€© 5
🎉 11
⭐ 4
k
Thanks for the extension! I managed to run it on a single project in VSCode, but it fails to start on the multi-root VSCode workspace unfortunately. I created an issue for that https://github.com/kedro-org/vscode-kedro/issues/10
n
@Kacper Leƛniara great find! You are right as the extension need to find where exactly is the Kedro project. If you have multiple workspace, the first will be the default if I haven’t mistaken, this hasn’t been documented clearly.
👍 1
k
Unfortunately it seems to be picking a random one? I have the Kedro project as the first entry in the workspace but its not picking it up
Is there a workaround to make it work consistently in the multi-root workspace for now? Or fallback to single project workspace is the only option?
n
It should pick the first workspace, if not then it’s a bug. In this case you may need to fallback to a single project workspace for now.
It’s great you already open an issue, I will look into this next week when I am back
k
Great, thanks!
n
@Kacper Leƛniara
```2024-05-15 124020.590 [info] from kedro.config import OmegaConfigLoader
ModuleNotFoundError: No module named 'kedro'```
I can see this error from the traceback you posted, have you selected the correct Python interpreter already? Using the `>Python: select interpreter command
And if you can include logs from the beginning it should shows some workspace config
k
Yes, the correct interpreter is used for this project (venv folder inside it)
Here are the logs from the beginning. I redacted it, but the important part is that its choosing the other project without Kedro - the 29th project in the workspace file. The first one is the one with Kedro.
Copy code
2024-05-15 11:01:30.212 [info] Name: Kedro
2024-05-15 11:01:30.212 [info] Module: kedro
2024-05-15 11:01:30.212 [info] Python extension loading
2024-05-15 11:01:30.212 [info] Python Interpreter: 
2024-05-15 11:01:30.212 [info] Waiting for interpreter from python extension.
2024-05-15 11:01:30.212 [info] Python extension loaded
2024-05-15 11:01:30.230 [info] Server run command: /Users/kacper.lesniara/Projects/<the_other_project_without_kedro>/venv/bin/python /Users/kacper.lesniara/.vscode/extensions/kedro.kedro-0.0.3/bundled/tool/lsp_server.py
2024-05-15 11:01:30.231 [info] Server: Start requested.
2024-05-15 11:01:31.479 [info] Traceback (most recent call last):
  File "/Users/kacper.lesniara/.vscode/extensions/kedro.kedro-0.0.3/bundled/tool/lsp_server.py", line 17, in <module>

2024-05-15 11:01:31.479 [info]     from kedro.config import OmegaConfigLoader
ModuleNotFoundError: No module named 'kedro'
Ok, I managed to make it working. By default it chooses the 29th project, not sure why (even alphabetically there are other projects before that). I supplied the
kedro.interpreter
at the workspace level to point to the project's python executable with Kedro, restarted VSCode and it works
Previously I must have been supplying it wrong. So there is a workaround to make it work on the multi-root workspaces
I updated the issue with more info and a workaround from this thread
n
So it is not a workspace problem but rather wrong Python interpreter?
Or is the extension somehow choose an interpreter not align with the workspace default?
k
The extension does not choose the interpreter from the first entry, but a different one (seems like a random one but is always the same). Also choosing only one interpreter globally for all the projects in the workspace isn't ideal. I would see it working more like the mypy extension where there is a server per folder/project in the workspace.
n
I see
so you have multiple kedro projects?
k
No, not yet in this workspace, but it will be the case - potentially with different kedro, kedro-dataset versions
n
Now i understand this a little bit more, you are using venv so you expect the extension works per workspace. I am a conda user so when changing project I don’t necessarily change a new environment.
👍 1
I am just thinking what should be done here instead, should the extension pick up the environment automatically when there is a venv folder? The more specific one takes priority maybe
k
In mypy extension I needed to change it's behaviour by setting
mypy.runUsingActiveInterpreter
to true in VSCode's
settings.json
. This way it's not using the global executable, but a local one per project (venv) in the workspace
đŸ‘đŸŒ 1
n
interesting! Can you put that into the issue too? I think that make sense and I could look into how the implementation looks like.
k
Sure thing! Thanks Nok 🙌
Done