Registry / observability / pypprof

pypprof

JSON →
library0.0.1pypypi✓ verified 82d ago

pypprof (version 0.0.1) adds HTTP-based endpoints to Python applications for collecting CPU and heap profiles, similar to Go's `net/http/pprof`. It leverages `zprofile` and `mprofile` under the hood for profile collection. The last release was in 2019, indicating the library is in a maintenance state rather than active development.

pip install pypprof
INSTALL
IMPORT
SIG · PYPPROF
P
pypprof
observabilitypythonv0.0.1
Install
3.0s avg
Import
Disk
26MB
Pass rate
4/ 10
Env Coverage4 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.0.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✕ build_error
✓ 2.93s
py 3.11
✕ build_error
✓ 2.6s
py 3.12
✕ build_error
✓ 3.48s
py 3.13
✕ build_error
✕ build_error
py 3.9
✕ build_error
✓ 3.1s
26MB installed
● package 26MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

start_pprof_server
import pypprof
from pypprof import start_pprof_server

This quickstart demonstrates how to integrate `pypprof` into a simple Python application to expose profiling endpoints. After running, you can access CPU and heap profiles via `go tool pprof` (requires Go installed) or `curl` against the exposed `/debug/pprof/` endpoints. A background thread continuously performs a CPU-intensive task to generate data for profiling.

from pypprof.net_http import start_pprof_server import time import threading def my_heavy_computation(): total = 0 for i in range(10000000): total += i * i return total def background_task(): while True: print(f"Performing heavy computation: {my_heavy_computation()}") time.sleep(1) if __name__ == "__main__": # Start the pprof server on port 8081 print("Starting pypprof server on port 8081...") start_pprof_server(port=8081) print("pypprof server started. Access profiles at http://localhost:8081/debug/pprof/") print("To fetch a CPU profile: go tool pprof -http=:8088 :8081/debug/pprof/profile") print("To fetch a heap profile: go tool pprof :8081/debug/pprof/heap") # Run a background task to generate some CPU load for profiling worker_thread = threading.Thread(target=background_task, daemon=True) worker_thread.start() try: while True: time.sleep(10) # Keep the main thread alive except KeyboardInterrupt: print("Exiting.")
Debug
Known issues
deprecatedThe `pypprof` library (version 0.0.1) was last released in October 2019 and is classified as 'Pre-Alpha' on PyPI. It is not actively maintained, and users might encounter compatibility issues with newer Python versions or modern application frameworks. Consider more actively developed profiling solutions for new projects.
fix
Evaluate alternative, actively maintained profiling libraries like `memory_profiler`, `cProfile`, `pyinstrument`, or framework-specific wrappers like `flask-pypprof` for Flask applications.
affects: <=0.0.1
gotchaMemory profiling functionality, which relies on the `mprofile` dependency, is only fully supported by default for Python >= 3.4. For Python versions between 2.7 and 3.3, memory profiling requires manually patching your Python installation and installing `mprofile`.
fix
For Python < 3.4, refer to the `mprofile` documentation for manual installation and patching instructions. For newer Python versions, `mprofile` should be a more straightforward dependency.
affects: Python < 3.4 (>= 2.7)
gotchaThe `mprofile` dependency, essential for memory profiling in `pypprof`, is known to only work on `linux/amd64` architectures. It does not support `linux/arm64` or other platforms, which can lead to failures when attempting memory profiling on unsupported systems.
fix
Ensure your application runs on a `linux/amd64` environment if memory profiling is critical. Alternatively, disable memory profiling or explore other profiling tools that support your target architecture.
affects: <=0.0.1
Upgrade
Version history
0.0.1latest on PyPI · released Oct 5, 2019
Audit
Dependencies
zprofilerequiredUsed for CPU profiling.
mprofileoptionalUsed for heap (memory) profiling. Required for Python >= 3.4, and for Python < 3.4, it needs manual installation and Python patching. Only supported on linux/amd64.
Agent activity
21 hits · last 30 days
node
18
OpenAI (training)
2
Amazon
1
Resources
pypprof — pip install pypprof · libregistry