Snoop

0.6.0 · active · verified Thu Apr 16

Snoop is a powerful Python library that provides detailed insights into code execution with minimal effort. It serves as a more featureful and refined alternative to traditional print debugging and PySnooper, incorporating its own version of 'icecream' for enhanced output. Currently at version 0.6.0, the library is actively maintained and designed for easy use in tracing function calls, variable values, and overall code flow.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates the basic usage of the `@snoop` decorator to automatically trace the execution and display variable values within a function. The output is sent to `stderr` by default.

from snoop import snoop

@snoop
def calculate_total(prices, tax_rate):
    total = sum(prices)
    tax = total * tax_rate
    final_total = total + tax
    return final_total

prices_list = [10, 20, 30]
rate = 0.08
result = calculate_total(prices_list, rate)
print(f"Final Total: {result}")

view raw JSON →