{"id":5241,"library":"google-python-cloud-debugger","title":"Google Cloud Snapshot Debugger for Python","description":"The Python Cloud Debugger client library (now known as Google Cloud Snapshot Debugger) allows you to inspect the state of a running Python application in Google Cloud without stopping or slowing it down. It works by capturing snapshots of application state. The current version is 4.1, with releases typically aligning with significant feature updates or bug fixes.","status":"active","version":"4.1","language":"en","source_language":"en","source_url":"https://github.com/GoogleCloudPlatform/cloud-debug-python","tags":["google-cloud","debugging","snapshot-debugger","firebase","production-debugging"],"install":[{"cmd":"pip install google-python-cloud-debugger","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Required for the Firebase Realtime Database backend, which is the default and only supported backend since v4.0.","package":"firebase-admin","optional":false}],"imports":[{"note":"Since version 3.0, and especially 4.0, the package `google-python-cloud-debugger` installs the module `snapshot_debugger`. The old `googleclouddebugger` module is no longer supported.","wrong":"import googleclouddebugger","symbol":"start","correct":"from snapshot_debugger import start"}],"quickstart":{"code":"import snapshot_debugger\nimport os\n\n# snapshot_debugger.start() attempts to auto-detect project ID and config.\n# For local testing, you might need to specify it or set environment variables.\n# Example for App Engine, Cloud Functions, GKE etc. it usually works out of the box.\n# For manual configuration if needed:\n# snapshot_debugger.start(project_id='your-gcp-project-id', module='your-app-name', version='1.0')\n\n# In a typical cloud environment, simply calling start() is sufficient.\n# Ensure your service account has 'Cloud Debugger' role.\n# For Firebase backend, the service account needs 'Firebase Realtime Database Admin' role.\nsnapshot_debugger.start()\n\nprint('Snapshot Debugger started. You can now set breakpoints in the Google Cloud Console.')\n\ndef main():\n    x = 10\n    y = 20\n    z = x + y # Set a breakpoint here in Google Cloud Console\n    print(f'Result: {z}')\n\nif __name__ == '__main__':\n    main()","lang":"python","description":"This quickstart demonstrates how to initialize the Snapshot Debugger in your Python application. After calling `snapshot_debugger.start()`, your application will connect to the Google Cloud Console, allowing you to set breakpoints and inspect variables without redeploying. Ensure your Google Cloud project is configured for Cloud Debugger and the service account has the necessary permissions (e.g., Cloud Debugger, Firebase Realtime Database Admin)."},"warnings":[{"fix":"Ensure your service account has permissions for Firebase Realtime Database and that your application can connect to Firebase. Existing integrations using the old API will break and require an update.","message":"Version 4.0 of `google-python-cloud-debugger` removes support for the deprecated Cloud Debugger API backend. It now exclusively uses the Firebase Realtime Database backend.","severity":"breaking","affected_versions":">=4.0"},{"fix":"Always use `from snapshot_debugger import ...` or `import snapshot_debugger` in your code. Do not attempt to import `googleclouddebugger` which is for older, unsupported versions.","message":"The PyPI package name is `google-python-cloud-debugger`, but the module you import and use is `snapshot_debugger`.","severity":"gotcha","affected_versions":">=3.0"},{"fix":"Migrate any existing Cloud Debugger API-specific configurations to leverage the Firebase Realtime Database backend. Ensure your environment and service accounts are configured for Firebase access.","message":"The original Cloud Debugger API has been deprecated by Google. The `google-python-cloud-debugger` library has shifted to use Firebase Realtime Database as its backend for snapshot debugging.","severity":"deprecated","affected_versions":"All versions, but enforced as breaking in >=4.0"},{"fix":"Ensure your application runs on Python 3.7 or a newer compatible version. Upgrade your Python runtime if you are still on 2.7 or an older 3.x version.","message":"Python 2.7 support was dropped in version 2.19. Modern versions of the library (>=3.x) require Python 3.7 or newer.","severity":"gotcha","affected_versions":">=2.19"}],"env_vars":null,"last_verified":"2026-04-13T00:00:00.000Z","next_check":"2026-07-12T00:00:00.000Z"}