Skip to main content

Agent-friendly remote Python debugger over a zero-dependency TCP API

Project description

apdb

apdb is an agent-friendly Python debugger inspired by remote-pdb. It keeps the Python call site close to pdb, but exposes debugger control over a newline-delimited JSON TCP API instead of a human interactive shell.

The runtime and CLI use only the Python standard library.

Python API

import apdb

answer = 41
apdb.set_trace(port=4444)
print(answer + 1)

set_trace() blocks the target process whether or not a client is connected. The process resumes only after the TCP API receives a release command such as continue, next, step, or quit.

By default, apdb binds to 127.0.0.1 and uses no authentication:

apdb.set_trace(port=4444, host="127.0.0.1")

CLI

The package installs apdb_cli:

apdb_cli ping --port 4444
apdb_cli state --port 4444
apdb_cli where --port 4444
apdb_cli locals --port 4444
apdb_cli eval 'answer + 1' --port 4444
apdb_cli next --port 4444
apdb_cli step --port 4444
apdb_cli continue --port 4444

The CLI prints one JSON response to stdout and exits nonzero for connection failures or API errors.

TCP API

The TCP API speaks newline-delimited JSON. Each request and response is one JSON object followed by \n.

Request:

{"id": 1, "cmd": "state"}

Response:

{"id": 1, "ok": true, "result": {"status": "paused"}}

Supported v0 commands:

  • ping
  • state
  • where
  • locals
  • eval
  • next
  • step
  • continue
  • quit

Security

apdb has no authentication in v0. Debugger access can inspect and evaluate code inside the target process. Bind to 127.0.0.1 unless you explicitly want to expose that control surface.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

apdb-0.1.0.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

apdb-0.1.0-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file apdb-0.1.0.tar.gz.

File metadata

  • Download URL: apdb-0.1.0.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for apdb-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f4a89cd5202e76eec7936a3ed38d2d4727bc1f8226d1c1fb35381e49658db52a
MD5 f69f26a3e4a534e7dc00dec16a434c45
BLAKE2b-256 f4ce7315a3d5cf1d2899c89e359e9ea96bb2ee7c49ee752e205154f4a683a26d

See more details on using hashes here.

File details

Details for the file apdb-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: apdb-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for apdb-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4c12e8ec99decf37f2dbc3b922bb1aa8f9da44a2ede401a4bfd4b6933bb9beb1
MD5 1ddacf8ab3830f8a38175d70eed7b576
BLAKE2b-256 7901d7497643dd666c2128d1919f1d239d3b5a63a2c7f8afd8eeff58c7ed9b9e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page