Skip to main content

gpulegion

Unified GPU telemetry for Apple Silicon, NVIDIA, and beyond.

PyPI version Python 3.9+

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 names
  • is_available() → True if GPU monitoring is supported
  • usage() → GPU utilization percentage (0-100) or None
  • power() → GPU power consumption in watts or None
  • memory() → Dict with used_mb and total_mb or None
  • device() → Dict with vendor, model, and device info or None

Design Philosophy

  • Never crash: Returns None when 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)

Source distribution for gpulegion 0.1.1
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)

Table of built distributions (wheels) for gpulegion 0.1.1
File Interpreter ABI Platform Actions
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.

Release history Release notifications | RSS feed

This release

0.1.1 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