gpulegion
Unified GPU telemetry for Apple Silicon, NVIDIA, and beyond.
Why gpulegion?
Existing Python GPU monitoring tools like GPUtil only support NVIDIA GPUs. If you're developing on Apple Silicon (M1-M5), you're out of luck.
gpulegion fills that gap with a simple, cross-platform API:
| Tool | Apple Silicon | NVIDIA | Programmatic API |
|---|---|---|---|
| GPUtil | ❌ | ✅ | ✅ |
| gputop | ❌ | ✅ | ⚠️ (CLI-first) |
| gpulegion | ✅ | ✅ | ✅ |
Installation
pip install gpulegion
Quick Start
import gpulegion as gl
# Check if GPU monitoring is available
if gl.is_available():
print(f"GPU Usage: {gl.usage()}%")
print(f"GPU Power: {gl.power()}W")
print(f"Device: {gl.device()}")
else:
print("No GPU detected")
API Reference
Core Functions
backends()→ List of available backend namesis_available()→ True if GPU monitoring is supportedusage()→ GPU utilization percentage (0-100) or Nonepower()→ GPU power consumption in watts or Nonememory()→ Dict withused_mbandtotal_mbor Nonedevice()→ Dict with vendor, model, and device info or None
Design Philosophy
- Never crash: Returns
Nonewhen data unavailable - Minimal dependencies: No heavy ML frameworks required
- Cross-platform: Works on macOS (Apple Silicon), Linux (NVIDIA), and gracefully degrades elsewhere
Platform Support
Apple Silicon (M1-M5)
Requires passwordless sudo access to powermetrics:
# Add to /etc/sudoers.d/powermetrics
your_username ALL=(ALL) NOPASSWD: /usr/bin/powermetrics
NVIDIA
Requires nvidia-smi (comes with NVIDIA drivers).
Example Output
>>> import gpulegion as gl
>>> gl.device()
{'vendor': 'Apple', 'model': 'Apple M2 Pro', 'arch': 'arm64'}
>>> gl.usage()
34.2
>>> gl.power()
12.8
Roadmap
- Apple Silicon support
- NVIDIA support
- AMD support
- Intel discrete GPU support
- Multi-GPU support
- CLI tool
Contributing
Contributions welcome! This library is intentionally minimal - we prioritize reliability over features.
License
MIT
Metadata
Release files for gpulegion 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gpulegion-0.1.1.tar.gz | 7.8 kB | Without provenance | Details for gpulegion-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gpulegion-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for gpulegion-0.1.1-py3-none-any.whl |
Total release size: 16.5 kB
Release files / gpulegion-0.1.1.tar.gz
| Download URL | gpulegion-0.1.1.tar.gz |
|---|---|
| Size | 7.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
72de6d55558468c3ada39b760e34beabe2642883dc80ff4edb508b285980c643
|
|
BLAKE2b-256 checksum How to use checksums |
2923463635f904f43913d0332af0de28ce95a1b36115f0f9b352dc77ce38a6a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.11
|
Release files / gpulegion-0.1.1-py3-none-any.whl
| Download URL | gpulegion-0.1.1-py3-none-any.whl |
|---|---|
| Size | 8.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0c58de7196e149abac24b3ae111a97690af5922077694f094c8487b6dc990d6e
|
|
BLAKE2b-256 checksum How to use checksums |
b14419ff9d18cd40ade7c73e24230285d8728486bf7e5a57579ce74f43b84147
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.11
|
Security for gpulegion 0.1.1
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.