Skip to main content

A tool to save and load a snapshot of a Python debugging environment.

Project description

debugsnap

Overview

debugsnap is a Python package designed to facilitate debugging by enabling the saving and loading of a snapshot of a Python debugging environment. This tool is especially useful when you would like to use the functionally interactive python for debugging, making it easier to analyze and understand complex code behaviors.

Installation

To install debugsnap, simply run the following command:

pip install debugsnap

Usage

To use debugsnap, follow these steps:

** Warning:** By default a new folder named tmp_save_snapshot will be created in your ~ directory and the shapshot files will be saved there. To avoid this behaviour you have to provide a storage_path.

  1. Saving the Debugging Snapshot: In your debug session, use the appropriate function to save the current snapshot. For example:

     from debugsnap import save_snapshot
     save_snapshot(local_vars=locals(), global_vars=globals())
    
  2. Loading the Debugging Snapshot: In a new Python session or an interactive environment, load the saved snapshot:

     from debugsnap import load_snapshot
     global_vars, local_vars = load_snapshot()
     globals().update(global_vars)
     locals().update(local_vars)
    

Snippets

In order to make the use of this package easier we suggest adding the following snippets to your VScode, by adding them to /snippets/python.json

    "Save Debug Snapshot": {
        "prefix": "save_snapshot",
        "body": [
            "from debugsnap import save_snapshot",
            "save_snapshot(local_vars=locals(), global_vars=globals())"
        ],
        "description": "Save the current state of local and global variables, excluding specific ones."
    },
    "Load Debug Snapshot": {
        "prefix": "load_snapshot",
        "body": [
            "from debugsnap import load_snapshot",
            "global_vars, local_vars = load_snapshot()",
            "globals().update(global_vars)",
            "locals().update(local_vars)"
        ],
        "description": "Load a saved state into the current global and local variables."
    }
  • Snapshot Saving: Captures the current snapshot of your Python environment, including variables and their values.
  • Snapshot Loading: Restores the saved snapshot in a new Python session, allowing for continued exploration and debugging.
  • Non-Picklable Object Handling: Gracefully manages non-picklable objects, ensuring a robust saving process.

Requirements

debugsnap requires Python 3.6 or later. Dependencies include:

  • dill >= 0.3.0

Contributing

Contributions to debugsnap are welcome!

License

debugsnap is released under the MIT License. See the LICENSE file for more details.

Contact

For questions or feedback, please contact v4lue4dded@gmail.com.

Author

Developed by v4lue4dded. Visit the GitHub repository for more information and updates.

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

debugsnap-0.1.4.tar.gz (3.1 kB view details)

Uploaded Source

File details

Details for the file debugsnap-0.1.4.tar.gz.

File metadata

  • Download URL: debugsnap-0.1.4.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for debugsnap-0.1.4.tar.gz
Algorithm Hash digest
SHA256 cdf7af12d3dd5df6cf16464d6da8b1b3c2253cc71a2ba887fb542b3a67135cdc
MD5 061b00f993658aa7c32b4ee3f1744f27
BLAKE2b-256 3cd86cb1e863431d450f61faf2f894a68f9a9f9a77e1a79ec96e159c2a867148

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