Skip to main content

pywhipper

PyPI Version License: MIT

pywhipper is a lightweight, zero-dependency Python profiler designed for developers who want clear, line-by-line insights into the runtime and memory behavior of their code. With support for both function-level and block-level profiling, pywhipper is an ideal tool for rapid debugging and performance analysis.


📦 Installation

Install pywhipper directly from PyPI:

pip install pywhipper

🚀 Key Features

  • 🔍 Line-by-line execution time tracking
  • 🧠 Optional memory usage measurement (via tracemalloc)
  • 🧩 Profile entire functions with @whip
  • ⚡ Profile code blocks with with whip()
  • 📋 Clean, readable console outputs

🧪 Quick Start

Profile an Entire Function & Profile a Specific Code Block

from pywhipper import whip

# -------------------------------
# ✅ Approach 1 – Manual reverse
# -------------------------------

@whip(use_memory=True)
def reverse_string(s):
    string_list = list(s)
    left = 0
    right = len(string_list) - 1

    while left < right:
        string_list[left], string_list[right] = string_list[right], string_list[left]
        left += 1
        right -= 1
    return "".join(string_list)

string = 'sooraj'
print("Approach 1 result:", reverse_string(string))


# -------------------------------
# ✅ Approach 2 – Python slicing
# -------------------------------

with whip("Approach 2 slice reverse", use_memory=True):
    print("Approach 2 result:", string[::-1])

📊 Example Output

Profiling Function: reverse_string
Total Time: 0.000709 seconds
Memory measured in KB (approx)
------------------------------------------------------------
demo.py:9 | 0.000016s | +0.12 KB | string_list = list(s)
demo.py:10 | 0.000379s | +19.35 KB | left = 0
demo.py:11 | 0.000017s | +0.00 KB | right = len(string_list) - 1
demo.py:13 | 0.000017s | +0.00 KB | while left < right:
demo.py:14 | 0.000018s | +0.00 KB | string_list[left], string_list[right] = string_list[right], string_list[left]
demo.py:15 | 0.000019s | +0.00 KB | left += 1
demo.py:16 | 0.000017s | +0.00 KB | right -= 1
------------------------------------------------------------
Approach 1 result: jaroos

Timing block: Approach 2 slice reverse
Approach 2 result: jaroos
Done in 0.000037s | Memory: +0.45 KB


📌 License

This project is licensed under the MIT License.


🙋‍♂️ Author & Contributions

Developed by SOORAJ K K.


⭐️ Why pywhipper?

pywhipper is designed for developers who want just the right amount of visibility into their code's behavior — without the overhead or complexity of full-scale profilers. Whether you're debugging a slow function, understanding memory leaks, or optimizing a script, pywhipper makes performance transparent, fast, and actionable.


Thank you for using pywhipper.

Metadata

Release files for pywhipper 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pywhipper 0.1.0
File Size Uploaded Provenance Actions
pywhipper-0.1.0.tar.gz 4.4 kB Without provenance Details for pywhipper-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pywhipper 0.1.0
File Interpreter ABI Platform Actions
pywhipper-0.1.0-py3-none-any.whl Python 3 none any Details for pywhipper-0.1.0-py3-none-any.whl

Total release size: 9.1 kB

Release files / pywhipper-0.1.0.tar.gz

Download URL pywhipper-0.1.0.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
34b99ccc9c4a9b2a3630410941446daf23f03d5266e019f156a03ebd823f249c
BLAKE2b-256 checksum
How to use checksums
f3b7137cbef2a269fc5e86856a208957c8ad99eeb613e8cb3abd80226fbba6b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release files / pywhipper-0.1.0-py3-none-any.whl

Download URL pywhipper-0.1.0-py3-none-any.whl
Size 4.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dec036c543b0d82619863c3030fc4765a3fdbd134bad1e1cdb6829aa43e8b279
BLAKE2b-256 checksum
How to use checksums
fd5391c6aa56980ae63b740610ec27786ad8dc66aa87fed2d1c4cc0cd25d7d13
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Security for pywhipper 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page