psutil
Cross-platform lib for process and system monitoring.
This package has a good security score with no known vulnerabilities.
Community Reviews
Battle-tested system monitoring with predictable performance
Error handling is pragmatic: permission errors raise `AccessDenied`, missing processes raise `NoSuchProcess`, and both inherit from `psutil.Error` for easy catching. The library handles edge cases like processes dying mid-measurement gracefully. One gotcha: `cpu_percent()` needs an interval or prior call to return meaningful data—first call with interval=None returns 0.0, which catches people initially.
Timeout behavior is synchronous and blocking by design, which is fine for most monitoring use cases but means you need to wrap calls in threads/async if you're polling aggressively. Cross-platform consistency is excellent—code written on Linux generally works identically on Windows/macOS with only minor platform-specific attribute differences clearly documented.
Best for: Building system monitoring dashboards, resource-aware autoscaling, or process management tools that need reliable cross-platform metrics.
Avoid if: You need pure async/await monitoring without threading overhead or require sub-millisecond sampling intervals.
Rock-solid system monitoring with excellent API design and type support
Type hints are excellent throughout, making IDE autocomplete incredibly helpful. You'll see exactly what attributes are available on each object without constantly checking docs. Error messages are clear and actionable - if you try to access a process that doesn't exist, you get a NoSuchProcess exception with the PID clearly stated. The documentation is comprehensive with practical examples for every function.
The process iteration API (`psutil.process_iter()`) is particularly well-designed, letting you filter by attributes upfront to avoid unnecessary system calls. I've used this in production monitoring tools, CLI utilities, and debugging scripts - it's consistently reliable and performant.
Best for: System monitoring tools, resource usage tracking, process management utilities, and performance profiling where cross-platform support is needed.
Avoid if: You need pure Python with no compilation step or are targeting extremely constrained embedded systems.
Remarkably intuitive system monitoring with excellent cross-platform support
The documentation is exceptional, with clear examples for every function and well-organized sections. Error messages are helpful - when you try to access a process that doesn't exist, you get a clear `NoSuchProcess` exception with the PID. Cross-platform quirks are well-documented (like certain Windows/Linux differences), which saves hours of debugging.
Debugging is straightforward because the library returns simple data structures (named tuples, floats, integers). When something breaks, it's usually a permission issue, and psutil makes that obvious with `AccessDenied` exceptions. The consistency across different OS platforms means code written on macOS generally works identically on Linux servers.
Best for: System monitoring tools, resource usage tracking, process management utilities, and DevOps automation requiring cross-platform compatibility.
Avoid if: You need only basic system info that standard library modules like os or platform already provide.
Sign in to write a review
Sign In