astral-sh / uv

An extremely fast Python package and project manager, written in Rust.
https://docs.astral.sh/uv
Apache License 2.0
20.42k stars 605 forks source link

Using "uv run" etc as Run/Debug configurations in PyCharm #7356

Open tmct opened 1 week ago

tmct commented 1 week ago

Hi,

uv run is extremely useful, I use it to launch scripts with a couple of dependencies with the minimum of virtual environment creation faff.

Sometimes I would like to debug the same script right then and there in PyCharm, but it doesn' seem to work out of the box: it doesn't seem to attach the debugger to the Python process when I create "uv run" as a shell script Run Configuration - I suppose that "uv" is not running as a Python process... Can you think of a good way of achieving this, or would I need to request that JetBrains make some official uv tie-in?

Thanks, Tom

konstin commented 6 days ago

Hi! We hope for native uv support in PyCharm eventually (https://youtrack.jetbrains.com/issue/PY-70533/Support-package-management-via-uv).

As a workaround, you can use a regular Python run configuration and call uv sync as a before launch external tool.