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=8888)
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=8888, host="127.0.0.1")

CLI

The package installs apdb_cli:

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

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.1.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.1-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: apdb-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 5b8b0fcbaf3b06355eb73de82b6c1e2d7b401f2b810fab9d52022d2a5ae379f6
MD5 afadce51c46f8c3b79ce9d24a8299f66
BLAKE2b-256 1e08f824bb21472ae71fbde14cb5ca7c46aabb87505a2499c8a7e567dab08110

See more details on using hashes here.

File details

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

File metadata

  • Download URL: apdb-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 72b97e3bbfe749ee498b9784b85ebb5f57a4d71ec0d7d3dc71ce0ad9766ac82e
MD5 5896c1e60ff62625049e56f2d1434076
BLAKE2b-256 d1806b1391f598dd985dcc0e60f30174ae8de8254427ff6ea0148100a44f6f20

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