A simple tool to monitor execution of functions.
Project description
eprofiler
Modern Execution, Memory & Audit Profiler for Python
A lightweight, zero-dependency toolkit to monitor performance and audit function lifecycles.
eprofiler provides high-precision decorators and context managers to identify bottlenecks and log execution metadata with minimal friction.
Installation
pip install eprofiler
Core Tools
@audit: Execution logging withSUCCESS/FAILstatus and error capturing.@timeit: Execution timing (microsecond precision).@memit: Simple peak memory tracking usingtracemalloc.@profile/@profile_cpu: Combined time, memory, and CPU profiling.Timer: Context manager and/or decorator for granular blocks.
Usage
1. Function Auditing (@audit)
Ideal for production logs where you need to know if a function finished, how long it took, and why it failed. Optinally which args used.
from eprofiler import audit
@audit(label="PAYMENT_GATEWAY", include_args=True)
def process_payment(user_id, amount):
# Logic here...
return True
process_payment(123, 50.0)
Output (Standard Logging):
INFO: {'timestamp': '2026-03-02T10:00:00.123', 'function': 'process_payment', 'label': 'PAYMENT_GATEWAY', 'args': (123, 50.0), 'status': 'SUCCESS', 'elapsed_seconds': '0.045200'}
2. Basic Timing (@timeit)
For quick performance checks during development. By default, results are printed to the console.
from eprofiler import timeit
@timeit(label="Computation")
def my_func():
return sum(i**2 for i in range(100000))
my_func()
Output: {'label': 'Computation', 'function': 'my_func', 'duration': 0.008421}
3. Comprehensive Profiling (@profile)
Track time and memory (current and peak) simultaneously.
from eprofiler import profile
@profile(label="Heavy Task")
def memory_intensive():
return [x for x in range(1000000)]
memory_intensive()
Output: {'label': 'Heavy Task', 'function': 'memory_intensive', 'duration': 0.041200, 'peak': 324502, 'current': 1204}
4. Advanced: Callbacks & Custom Capture
Instead of printing to the console, you can capture results programmatically.
from eprofiler import audit
def my_db_callback(payload):
# Send payload to Datadog, Slack, or a Database
print(f"Captured: {payload['status']} in {payload['elapsed_seconds']}s")
@audit(callback=my_db_callback)
def sync_data():
pass
Links
- PyPI: https://pypi.org/project/eprofiler/
- GitHub: https://github.com/eyukselen/eprofiler
- Docs: https://eprofiler.readthedocs.io
Why eprofiler?
- Fixed-Width Timing: All durations use
:.6fformatting for perfect vertical alignment in logs. - Machine Readable: All outputs are valid Python dictionaries (easily convertible to JSON).
- Fail-Safe: The
@auditdecorator useslogger.exceptionto ensure stack traces are preserved on failure. - Accuracy Note: When using
@profileor@memit, Python'stracemallocadds a slight overhead. For the most precise timing-only results, use@timeit.
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
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
File details
Details for the file eprofiler-0.0.8.tar.gz.
File metadata
- Download URL: eprofiler-0.0.8.tar.gz
- Upload date:
- Size: 8.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d652f8c69cf0546e2cd9ea725f8a0efcdad75943ea6d39f2262ed9700a358ba7
|
|
| MD5 |
74ff6b2dbb0b5da7ccc26bb97935a022
|
|
| BLAKE2b-256 |
220785dc1de540ad7bc7e1485a46d86f5c3fce665f07c7824aeb8ca5568b4c6f
|
File details
Details for the file eprofiler-0.0.8-py3-none-any.whl.
File metadata
- Download URL: eprofiler-0.0.8-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
027c049f2473808d2739481edc861c0b44ed69c1d190678bf3978eeb0010728d
|
|
| MD5 |
1f6ac4e1b85381be98c206b0a4b75ede
|
|
| BLAKE2b-256 |
b928ae1afbd95facaa8a916960ce4fd812c69fe14574634af7150e870272ed56
|