TECHNOLOGY PREVIEW - PYTHON SCRIPT DEBUGGER BASED ON DEBUG ADAPTER PROTOCOL

We recently released a new version of AlterNET Studio, which supports IronPython scripting/debugging - you can download it to see how it works.

IronPython is compatible with Python 2.7 and is designed to work with .NET Framework libraries. This is a perfect solution for users looking to add lightweight Python scripting to their applications. The downside of IronPython is that it’s not compatible with Python 3 (yet), and it’s hard to estimate when it will get there. Another limitation is that it does not support popular python libraries, like NumPy.

With that in mind, we started looking at implementing script debugging using native tools that support Debug Adapter Protocol (DAP), such as Python.

The Debug Adapter Protocol makes it possible to implement a generic debugger for a development tool that can communicate with different debuggers via Debug Adapters. Several Debug Adapters are already implemented for various programming languages, including Python, C/C++, Java, Lua, and others.

For now, we have created a proof-of-concept prototype of the Python debugger, which includes the following parts:

  • Script Debugger based on Debug Adapter Protocol for Python. The Debug adapter server runs in the same application process and sends/receives debugging commands and events from the application via TCP/IP protocol.

  • Code editor with LangServer.org - based Python code parser. Like Debugger Adapter Protocol, the LangServer protocol is used between a tool (the client) and a language smartness provider (the server) to integrate features like auto complete, go to definition, find all references, and like into the tool.

  • Python.NET package that allows accessing .NET objects from Python code. In our example, we have just used the WinForms MessageBox class to verify it’s possible.

There’s a way to go from this prototype to a fully working version, and the full implementation of the Script debugger based on DAP is scheduled for the next major release (version 8).

In the future, we will look at supporting debugger adapters for other programming languages, including C/C++ and Java.

Previous
Previous

XML VALIDATION AND CODE COMPLETION

Next
Next

CODE PARSING EXPLAINED