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(
"board_w=%.2f cpu_usage=%.3f gpu_usage=%.3f"
% (
metrics.power.board,
metrics.cpu_usage[0].usage if metrics.cpu_usage else 0.0,
metrics.gpu_usage[0].usage if metrics.gpu_usage else 0.0,
)
)
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.7.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| macmon_lib-0.7.2-cp39-abi3-macosx_11_0_arm64.whl | CPython 3.9 | abi3 | macOS 11.0+ ARM64 | Details |
Release files / macmon_lib-0.7.2-cp39-abi3-macosx_11_0_arm64.whl
| Download URL | macmon_lib-0.7.2-cp39-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 243.5 kB |
| Tags | CPython 3.9 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
bb0e04fc4396ab1e556c486703dcb37410f2957568223458d518acda75812f97
|
|
BLAKE2b-256 checksum How to use checksums |
1dfd09ee138985f8e6480504da9c6ff16d551d488ecaf81cbb856d93785fea18
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|