Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tomlin7/debug-adapter-client
Client implementation for the Debug Adapter Protocol (https://microsoft.github.io/debug-adapter-protocol) that is used in IDEs, editors and other tools to communicate with different debuggers
https://github.com/tomlin7/debug-adapter-client
adapter code-editor dap debugger debugger-api debuggers debugpy editor ide
Last synced: about 2 months ago
JSON representation
Client implementation for the Debug Adapter Protocol (https://microsoft.github.io/debug-adapter-protocol) that is used in IDEs, editors and other tools to communicate with different debuggers
- Host: GitHub
- URL: https://github.com/tomlin7/debug-adapter-client
- Owner: tomlin7
- License: mit
- Created: 2024-07-09T07:04:54.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-07-20T09:23:38.000Z (6 months ago)
- Last Synced: 2024-11-26T14:14:49.543Z (about 2 months ago)
- Topics: adapter, code-editor, dap, debugger, debugger-api, debuggers, debugpy, editor, ide
- Language: Python
- Homepage: https://tomlin7.github.io/dap
- Size: 754 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# [DAP Client: Debug Adapter Protocol Client for Python](https://tomlin7.github.io/dap/api-reference/)
DAP Client is an up-to-date generic client side implementation of the [Debug Adapter Protocol (DAP)](https://microsoft.github.io/debug-adapter-protocol/) that is used in IDEs, editors and other tools to communicate with different debuggers. The client is not tied to any specific debugger, so it can be used to interact with any debug adapter that implements the DAP protocol, significantly reducing the effort required to build a new debugging tool. For a list of supported debug adapters, see the [official specification](https://microsoft.github.io/debug-adapter-protocol/implementors/adapters/).
## Key Features
- **Sans I/O Implementation**: A protocol-only client that can be integrated into any I/O framework.
- **Abstract Clients**: Ready-to-use threaded and asyncio clients for immediate integration.
- **Flexible Architecture**: Easily extensible to support various debugging scenarios.## Table of Contents
1. [Installation](#installation)
2. [Quick Start](#quick-start)
3. [Usage Examples](#usage-examples)
4. [API Reference](https://tomlin7.github.io/dap/api-reference/)
5. [License](#license)## Installation
Install DAP Client using pip:
```bash
pip install dap-python
```## Quick Start
The following example demonstrates how to use the async client to connect to a [`debugpy`](https://aka.ms/debugpy) debug adapter server that is running on port 1234.
```bash
python -m debugpy --listen localhost:1234 --wait-for-client hello.py
``````python
import asyncio
from dap import AsyncServerasync def main():
server = AsyncServer("debugpy", port=1234)
try:
await server.start()
except asyncio.CancelledError:
await server.stop()if __name__ == "__main__":
asyncio.run(main())
```## Usage Examples
### Using the Sans I/O Client
The sans I/O client allows you to implement your own I/O mechanism:
```python
from dap import Client
from dap.responses import Initializedclient = Client()
client.launch(no_debug=True)# get the request data
request = client.send()# send the request using your I/O implementation
# ...# feed the response data to the client
for result in client.receive(response_data):
if isinstance(result, Initialized):
print("The debug adapter is initialized.")
...
```### Using the Threaded Socket IO Client
The threaded client provides a simple interface for synchronous usage:
```python
from dap import ThreadedServerserver = ThreadedServer("debugpy", port=1234)
server.start()
client = server.client# Use the client synchronously
client.launch()
client.disconnect()
server.stop()
```### Using the Asyncio Client
The asyncio client offers an asynchronous interface:
```python
import asyncio
from dap import AsyncServerasync def debug_session():
server = AsyncServer("debugpy", port=1234)
server.start()
client = server.clientclient.launch()
client.disconnect()
server.stop()asyncio.run(debug_session())
```## License
DAP Client is released under the [MIT License](./LICENSE).