No project description provided
Project description
PeekPy
PeekPy is a lightweight Python library for collecting runtime statistics and profiling function calls.
- ✅ Easy to integrate using decorators
- ⏱️ Built-in analyzers like call counter and execution timer
- 🧩 Extensible via custom analyzers
- 📦 Production ready and configurable
Installation
pip install peekpy
Quick Start
from peekpy.core.analyzers.call_counter import CallCounter
from peekpy.core.analyzers.timer import TimerCount
from peekpy.storage import save_stats_to_file
enable() # Enable PeekPy globally
@analyze(analyzers=[CallCounter(), Timer()])
def my_function(x, y):
return x + y
my_function(3, 4)
my_function(1, 2)
print(manager.get_stats()) # Print collected stats
save_stats_to_file("stats.json")
Features
- CallCounter → tracks how many times a function is called
- Timer → measures execution time per call
- StatsManager → central place to store and export stats
- @analyze() → flexible and customizable decorator
Usage
@analyze Decorator
@analyze(analyzers=[CallCounter(), Timer()])
def your_function(): ...
Each analyzer must implement a .before() and .after() method, and inherits from BaseAnalyzer.
Enable or Disable Analysis Globally
from peekpy.config import enable, disable, is_enabled
enable()
# or
disable()
Exporting Statistics
All statistics are collected by the StatsManager singleton:
import peekpy
from peekpy.storage import save_stats_to_file
print(json.dumps(peekpy.get_stats(), indent=4))
save_stats_to_file("stats.json")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
peekpy-0.1.0a4.tar.gz
(7.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
peekpy-0.1.0a4-py3-none-any.whl
(11.2 kB
view details)
File details
Details for the file peekpy-0.1.0a4.tar.gz.
File metadata
- Download URL: peekpy-0.1.0a4.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.10.18 Linux/6.11.0-1015-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f0a13b6de0f7bea20cae534963e26dfa34c4d076fadd10fc82468ef725572c19
|
|
| MD5 |
905fa303baa853fbe3244af0a42eef72
|
|
| BLAKE2b-256 |
f9e7876b6497ee5dfe2a2b866fbdc0dd3d7bc8c6427eca3bd57f7dbc5b0783fe
|
File details
Details for the file peekpy-0.1.0a4-py3-none-any.whl.
File metadata
- Download URL: peekpy-0.1.0a4-py3-none-any.whl
- Upload date:
- Size: 11.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.10.18 Linux/6.11.0-1015-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8a1af5ea282ab5072a6782968642242087181d6e1565ff4e6a2c0d111893d001
|
|
| MD5 |
bf2bf27a281d9bb92e5412798e480891
|
|
| BLAKE2b-256 |
400f909841c9526caa980f84c1b19558d50ed90ab353e220716dc2278c2305a1
|