Skip to main content

Fast Python bindings for macmon.

The wheel bundles the native library, so it installs and runs without separate external binaries.

Usage

Sampler.metrics() returns the current cumulative sample immediately. The caller is responsible for timing and timeout policy, so the library does not need its own async API.

import asyncio

from macmon import Sampler, soc_info


async def main() -> None:
    info = soc_info()
    print(info.chip_name)

    with Sampler() as sampler:
        while True:
            metrics = sampler.metrics()
            print(
                "chip_w=%.2f media_w=%.2f cpu_usage=%.3f gpu_usage=%.3f"
                % (
                    metrics.chip_power,
                    metrics.media_power,
                    metrics.cpu_scaled_ratio,
                    metrics.gpu_scaled_ratio,
                )
            )
            await asyncio.sleep(1.0)


asyncio.run(main())

For a more complete example, see example.py.

Develop

Editable install

From the repository root:

make cmacmon
cd python
pip install -e .

Wheel

From the repository root:

make python_wheel

The repaired wheel is written to python/wheelhouse/.

Metadata

Release files for macmon-lib 0.10.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for macmon-lib 0.10.0
File Interpreter ABI Platform Actions
macmon_lib-0.10.0-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details for macmon_lib-0.10.0-cp39-abi3-macosx_11_0_arm64.whl

Release files / macmon_lib-0.10.0-cp39-abi3-macosx_11_0_arm64.whl

Download URL macmon_lib-0.10.0-cp39-abi3-macosx_11_0_arm64.whl
Size 267.7 kB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
ddf5ca70b5407d53ff2c4e5f724a1f5a754de105a312c9d3152a430fc3bd125e
BLAKE2b-256 checksum
How to use checksums
e4f112820c0ab37c1835c0ec9c6bb472d7da43c264eee0437907a511dbf6320e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Security for macmon-lib 0.10.0

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.

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