#As for the LSP troubleshooting I'm
1 messages · Page 1 of 1 (latest)
Got it. So when I'm making a new standalone module with dagger init --sdk=python it's easy, just cd into the new module dir and run my editor with uv like
uv run zed .
If I'm daggerizing a project and will have a .dagger directory within it, then running the above in the root of the project won't work for the LSP, so I should run it within the .dagger (you say within .dagger/.venv but in .dagger was enough for me).
But I don't get LSP support in the original window after that, just in the second window with the dagger module code only.
So need two windows for now, eh, to work on the whole project (dagger and non-dagger)?
(you say within
.dagger/.venvbut in.daggerwas enough for me)
That was me saying that the.venvis in a subdir, but you should run from its parent directory so that.venvis at the root of the IDE "workspace".
So need two windows for now, eh, to work on the whole project (dagger and non-dagger)?
That's just the simpler solution so you don't have to fiddle with IDE settings but if you want to it depends on the IDE. You'll need to read the docs on how your IDE handles monorepos with multiple virtual envs in Python. Nothing special about a Dagger module, it's a normal Python project. For example, this is for VS Code: https://github.com/microsoft/vscode-python/wiki/Mono-Repo-Set‐up-Guide#scenario-2-separate-virtual-environments.
The improvement I want to make easier is sharing the virtual env with the main project, using a workspace. That way you can have a single virtual env at the root of the project, meaning you don't need monorepo support in the IDE. Just the one at the root will do. There's more about this in https://github.com/dagger/dagger/issues/8583.
experiencing this again while reviewing the quickstart for agents
had to drop into the .dagger directory and run uv run <ide> .
going to try the separate venvs...maybe later
yep same. When I have a dagger python module under .dagger and run uv run <ide> . from the project root, uv doesn't generate a venv at all because all the python code is in that .dagger subdirectory
You can also do uv run --directory .dagger <ide>.
That does the same as running uv run <ide> . from the .dagger subdir (maybe thats what you were saying). What we want to do is open the project root in the ide and have type hints and auto completes for a module thats not in the project root. Maybe its not possible without special ide configuration?
That does the same as running
uv run <ide> .from the .dagger subdir
Yeah, that's what I meant.
Maybe its not possible without special ide configuration?
Not right now but I plan on supporting uv workspaces, just haven't had time yet. You'll be able to do that then without special IDE config, but will require manual setup on dagger.json though. So not completely automatic.
How do you guys do with Go? I also cd into the module before calling vim in Go. Do your IDEs pick multiple modules seamlessly?
Do your IDEs pick multiple modules seamlessly?
Yeah at least in zed and I believe in vscode it respects the closest go.mod so it just works out of the box
VSCode and others could do the same for Python. They just don't go the extra mile in doing that automatically. It's not hard to do it manually though, like you don't need to edit a json configuration file or anything, just need to do some right clicking and manually marking other roots in the project. Both VSCode and PyCharm.
Cool I'll see if theres a way to do this in zed. It may not be supported yet without actually editing a config file because their .venv support is relatively new
Not supported in zed yet (but maybe soon 😅 ) https://github.com/zed-industries/zed/issues/21743#issuecomment-2709027945
Check for existing issues Completed Describe the bug / provide steps to reproduce it Zed is unable to find the python installed when using an environment created by uv https://github.com/astral-sh/...
cc other zed users ( @analog comet @lusty lava )
You currently must open the module source folder directly for python IDE integration (uv run --directory .dagger zed .)
Maybe we can poke our friends at zed to get the issue resolved 👼
Something we could add to our Dagger VS Code extension perhaps
No, its an editor concern, not a dagger concern. This is probably already possible in vs code with the python extension and the proper configuration. I don't have vs code installed right now but I can document the vs code way of doing this if nobody else has it handy
Right, I mean a workflow/script in our extension to make that easy/automatic, assuming such things exist
sure but right now there's no reason to install the dagger vscode extension (last I checked it was just Cue LSP), so its not like they'll be installing it anyway and we're automating anything behind the scenes