Skip to main content

CPU, GPU, and NPU hardware topology and telemetry for Python.

Project description

mainboard banner

CI Publish PyPI Python Docs Coverage

Installation

pip install mainboard         # CPU and Apple probing, pure Python
pip install mainboard[cuda]   # adds NVIDIA telemetry via the CUDA Python bindings

Working in a chefe project? Add it to your manifest:

chefe add mainboard -l python

The base install is light and pure Python, so GPU-less Linux hosts like a Raspberry Pi pull nothing CUDA-related. The cuda extra installs the NVIDIA bindings on Linux for full GPU detection and telemetry, and provider detection degrades gracefully to no NVIDIA devices whenever the bindings or the hardware are absent.

What it is

mainboard tells Python what compute is on the current machine, without assuming the world is only CUDA. It models CPUs, GPUs, and NPUs as Units, keeps vendor-specific probing behind providers (Apple and NVIDIA today), and gives you the whole board in one call.

from mainboard import Machine

print(Machine().model_dump_json(indent=2))   # cpu, memory, gpus, npus, and the host environment

Usage

machine = Machine()
machine.cpu.snapshot()             # CPU identity and capacity
machine.gpus[0].snapshot()         # per-GPU telemetry
machine.environment                # user, group(s), and job scheduler on the host
machine.model_dump_json()          # one-call JSON probe of the whole machine

The CLI renders a Rich schematic of the board:

mainboard

Timing spans

span is a lightweight, nestable timer for production code, off by default so a disabled span costs one boolean check. with span("extract"): or @span times a block or a function (sync or async, nesting tracked per-asyncio.Task via a ContextVar so concurrent tasks never share a stack), and every closed span folds into a Collector — the process-wide default, or one you own for a scoped window such as a single request.

from mainboard.profiling import enable_spans, span

enable_spans()

with span("pipeline"):
    with span("extract"):
        ...
    with span("embed"):
        ...

Read the result with Collector.records() (the raw per-occurrence log) or Collector.stats() (per dotted-path count/total/mean/p50/p95/max), and print either with .report() or .show(). See docs/profiling.md for the full profiling API, including the GPU-sampling Profiler.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mainboard-0.0.8.tar.gz (144.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mainboard-0.0.8-py3-none-any.whl (119.5 kB view details)

Uploaded Python 3

File details

Details for the file mainboard-0.0.8.tar.gz.

File metadata

  • Download URL: mainboard-0.0.8.tar.gz
  • Upload date:
  • Size: 144.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mainboard-0.0.8.tar.gz
Algorithm Hash digest
SHA256 d53a6362b6aeb2cd5db27805f1157a569f1286a55ec16b28af058f5b76ff5d58
MD5 43139165f945022645b5ab5d7aa5d9b3
BLAKE2b-256 b29065220f782f55d6fb13c5905315788d335c6b614bd530b06b57c9607d6a81

See more details on using hashes here.

Provenance

The following attestation bundles were made for mainboard-0.0.8.tar.gz:

Publisher: publish.yml on phvv-me/mainboard

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mainboard-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: mainboard-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 119.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mainboard-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 83160c2118d176baf0a8af3faeba2dde64aee547dcd0d8901c5eaf9f71990ca1
MD5 3113b6d1f826d92f83d2097b3bd81bd6
BLAKE2b-256 512fb8461836d33f0715033ced86586eaea871c9bfe381288539c00eeecaf88e

See more details on using hashes here.

Provenance

The following attestation bundles were made for mainboard-0.0.8-py3-none-any.whl:

Publisher: publish.yml on phvv-me/mainboard

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page