question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Consideration for ANSI output over IPC / "next-gen" remote debugging

See original GitHub issue

Hey @jonathanslenders 😸

I was wondering what you thought about the idea of formalizing an API / configuration that would make it possible run ptk in a remote process and ship output over an IPC channel such that native remote debugging with things like coolio tab completion and syntax highlighting can be a thing; bringing the wonder of Python’s interactivity to distributed systems dev.


I’ve got a couple issue written up that cover my research up to this point:

  • goodboy/tractor#130
  • goodboy/tractor#113

As far as I gather ptk is pretty much the project (even outside python) capable of this feat and so I thought I’d start here 😃

I’ll requote:

The problem

Standard fancy (read human enhanced) debugger repls (including the stdlib’s pdb which uses rlcompleter, and pdb++) rely on libraries such as GNU readline to get things like completion and CLI “editting controls”. There seems to be no way to get these features with readline based systems in a remote debugging context since Python’s use of readline requires that the process is launched under a tty/pty system. Ideally these features are available in such use cases to make debugging of remote systems sane and efficient for the user.


I’ll re-summarize a few things we’ve discovered poking around these repos and which we’ve already listed in the above issues:

  • options for doing this in a tmux-like app: prompt-toolkit/python-prompt-toolkit#1087
  • mention about using IPC to ship ANSI output
  • further discussion around capturing the output
  • a PR showing how to reroute output to stderr if it’s a tty
  • there seems to be test code suggesting ptk can work without being connected to a tty/pty.
  • there’s a utility for avoiding the clobbering of stdout that looks to be exactly what I had envisioned for a minimal control repl
  • a very old pdb implementation built on ptpython, ptpdb which is likely where we’ll need to start
  • ptk has utils for not clobbering stdout which would be super handy for having multiple actors logging while your in the middle of debugging a crash.

Would be greatly interested in what other things I’ve missed and any further input you might have. Also I can add the explicit issue/repo links to that list if this issue is something you deem worth tracking.


Also a couple things wrt projects built on top of ptk (or wanting to support it):

Also fwiw I have tried out ptpdb and I think it’s super slick but, it might just be a bit too much as a default, with the full terminal UI and all (though having that kind of full UI glory is definitely nice to have if the user so chooses).

One of the critical UX things I’m hoping for is the ability to work with a prompt while other asynchronous things are writing to the local tty and not having that prompt get clobbered. I pointed above to a couple things above but I’m hoping you can give me even more pointers on how to accomplish this 🕵️.

Look forward to your thoughts 🏄

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
jonathanslenderscommented, Aug 21, 2020

@goodboy : A PromptSession can run in an AppSession. The PromptSession is the object that keeps track of the input history during several input queries, as well as copy/paste registries (and maybe a few other things). The AppSession provides an environment with input/output objects in which all applications can run.

0reactions
goodboycommented, Aug 19, 2020

Dug into ipython (very very) briefly and found where the ptk object entrypoints are:

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fancy remote debugging (aka tab completion and editor controls ...
I haven't been able to find a remote debugger that supports this feature either ... Consideration for ANSI output over IPC / "next-gen"...
Read more >
Using Remote Debugging - 2022.2 English - Xilinx
Xilinx provides the following ways to debug or upgrade your design remotely: Use the Xilinx Hardware Server product to connect to a remote...
Read more >
Frequently Asked Questions for FreeBSD 7.X, 8.X, and 9.X
This is the FAQ for FreeBSD versions 7.X, 8.X and 9.X. All entries are assumed to be relevant to FreeBSD 7.X and later,...
Read more >
EP2789185B1 - Mobile traffic optimization based on public or ...
This enables optimizations to be applied to devices regardless of the operator or service provider, thereby enhancing the user experience and managing network ......
Read more >
match access-group through mls ip pbr - Cisco Content Hub
VLAN interfaces without Layer 3 addresses. Physical LAN ports that are configured to support Ethernet over Multiprotocol Label Switching (EoMPLS). Logical LAN ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found