omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Visual Debugger for pythonista [share]

    Pythonista
    vdb debugger
    4
    9
    7439
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • JonB
      JonB last edited by

      I have been toying with various ideas for a pythonista debugging system for a long time, to replace pdb in the console. With ObjC, we can finally integrate this into the editor itself.
      Here is a working, albeit not yet complete, visual debugger. right now it supports stepping in/over/continue/quit, as well as a Locals/Globals display (read only right now).

      I have separately working an overlay system for setting breakpoints by tapping the line number, though this is not yet fully baked and is not integrated into the main class yet (see inwork folder) I think I want to also go back to my older line highlight method (currently using editor annotations, but the "warning" is not overridable and interferes with the interface a bit)...

      Anyhoo, here's the Readme/install/screenies:

      Visual Debugger(vdb)

      interactive debugger inside pythonista editor

      ##features

      • single stepping, or step over
      • continue, or quit
      • watch window (view only right now)
      • During debugging, current line is highlighted, and editor opens new file if needed

      ##TODO:

      • breakpoint set/clear by tapping line s
      • launch script via menu
      • stack up/down
      • help menu
      • optimizations for small devices

      usage (where debugging is needed)

      	import vdb
      	vdb.VDB().set_trace()
      	
      

      ##install
      Thanks to @ywangd for this method.

      import requests as r; exec r.get('https://raw.githubusercontent.com/jsbain/vdb/master/get_vdb.py').text
      

      screenshots

      watch window
      ui overview

      Phuket2 1 Reply Last reply Reply Quote 6
      • ywangd
        ywangd last edited by

        I like ObjC heavy code. It's always worth learning. Thanks for sharing.
        PS: you may wanna mention it requires the beta.

        1 Reply Last reply Reply Quote 1
        • Phuket2
          Phuket2 @JonB last edited by

          @JonB , hmmm, I am back 😱
          Sorry, it's not working for me. I assume it works for Pythonista v2 beta.
          Is installed. But not sure why. If I don't run your test vdb_test.py, the import module can not find module vdb in other files.
          Then when I use it even in your vdb_test.py I never get to see the ui View.

          Some of the warning to the console

          Traceback (most recent call last):
          File "_ctypes/callbacks.c", line 314, in 'calling callback function'
          File "/var/mobile/Containers/Bundle/Application/956011B9-D2AE-4CA3-A416-47CD071AB988/Pythonista.app/Frameworks/PythonistaKit.framework/pylib/site-packages/objc_util.py", line 820, in OMMainThreadDispatcher_invoke_imp
          retval = func(*args, **kwargs)
          File "/private/var/mobile/Containers/Shared/AppGroup/A83A4237-28DA-41B4-AA91-84BC6770F30C/Documents/site-packages/vdb/debug_menu.py", line 44, in create_menu

          ywangd 1 Reply Last reply Reply Quote 0
          • ywangd
            ywangd @Phuket2 last edited by

            @Phuket2 You are right about not able to import vdb. A __init__.py file is needed to make vdb a module.

            Phuket2 1 Reply Last reply Reply Quote 1
            • Phuket2
              Phuket2 @ywangd last edited by

              @ywangd , thanks. That fixed the import problem 👍

              1 Reply Last reply Reply Quote 0
              • JonB
                JonB last edited by

                You are right, when I tested I simply ran the vdb_test script, which is in the same folder so worked. I suspect other things such as loading the step icon images only work when running from the folder, since I was lazy and didn't use absolute paths.

                This was more of a proof of concept at this point. I spent an embarrasinly long amount of time working out how the Bdb interface would look so that it blocked for user interaction, yet was also cancelable using a KeyboardInterrupt.

                Phuket2 1 Reply Last reply Reply Quote 0
                • Phuket2
                  Phuket2 @JonB last edited by

                  @JonB , it's ok. I just wanted to try it. Will wait until you get time to update it

                  1 Reply Last reply Reply Quote 0
                  • Tizzy
                    Tizzy last edited by

                    Awesome! will give it a go later, but I think things like this are important for thinking of pythonista as a full-fledged IDE.

                    1 Reply Last reply Reply Quote 0
                    • JonB
                      JonB last edited by

                      I updated the repo to act as a package. Also,

                      import vdb
                      vdb.set_trace()
                      

                      should work, similar to the way pdb works.

                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post
                      Powered by NodeBB Forums | Contributors