Debugging nameko services with Visual Studio Code

Your launch.json should just have "program" set to the path to nameko
(`which nameko`), otherwise that should just work? Then you can hit debug
in vscode.

So something like an entry in vscode's launch.json:

{
  (other standard python configs)
  "program": "/path/to/nameko",
  "args": [
     "run",
     "<blargh>"
   ]
}

···

On Tuesday, February 13, 2018 at 2:06:44 PM UTC, Chris Platts wrote:

Hi,

After lots of manual 'nameko run' runs, a lot of Ctrl+C'ing and an
unpleasant amount of debug-by-print()'ing, I'm trying to get a decent
configuration sorted in my IDE (Visual Studio Code, with Python extension
installed.)

In case you've not tried vscode (it's quite good!), it allows
configuration of launch profiles. For Python code, this wants:

a) The path to python.exe
b) The 'program' -- i.e., what's passed to python.exe on the command-line
c) Program arguments
d) Other misc. optional stuff (e.g. a launchTask to execute before
debugging starts, arguments for the program, etc.)

...plus, it can do stuff like attach to a running Python

I'm trying to simulate `nameko run --config=config.yml service`, but with
vscode attached to the process to hit breakpoints, allow watches, etc.

Has anyone had any luck with this (or indeed, with a different IDE? The
principles would be the same...)

I tried using vscode's ability to attach to processes, but the debugger
crashes when connecting to nameko's --backdoor-port.

Or am I over-thinking this, and it's best just to add a __main()__ to the
service's module and spin up a container/runner/etc. from there?