Metadata-Version: 2.4
Name: lagwise
Version: 0.2.0
Summary: Lightweight watchdog that flags slow function calls in production
Author: ZUHAYR
Project-URL: Homepage, https://github.com/ZUHAYR-A/lagwise
Keywords: performance,profiling,debugging
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Development Status :: 3 - Alpha
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Dynamic: license-file

\# lagwise



A lightweight, near-zero-overhead watchdog that flags slow function calls,

built to stay on permanently, including in production, not just during

local debugging.



\## Install



&#x20;   pip install lagwise



\## Usage



&#x20;   import lagwise



&#x20;   lagwise.enable(threshold\_ms=500)  # default is 500ms



Any function call exceeding the threshold prints a warning with its

arguments, elapsed time, and location. No code changes needed anywhere

else in your app.



\## Example output



&#x20;   ⏱ SLOW: handle\_checkout\_request(user\_id=42) took 484.8ms app.py:54



\## What it handles correctly



\- Nested calls: a slow parent function is flagged with its true total

&#x20; time, including everything that happened inside it

\- Recursive calls: each recursion level is timed independently and

&#x20; accurately, with no cross-contamination between levels

\- Loops: only actual function parameters are shown, not internal loop

&#x20; variables, keeping output readable even inside heavy loops



\## Turning it off



&#x20;   lagwise.disable()



\## A note on overhead



lagwise uses sys.setprofile, which is significantly cheaper than

line-by-line tracing, but it is still a global, single-owner hook, only

one profiler can be active per process at a time. If your code also uses

cProfile or another profiling tool simultaneously, they will conflict.



\## License



MIT

