Fast Python bindings for macmon with a bundled native library and no external runtime binaries
Project description
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/.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file macmon_lib-0.7.0.post1-cp39-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: macmon_lib-0.7.0.post1-cp39-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 265.5 kB
- Tags: CPython 3.9+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02ef00b89347182f176df715f6853f76f0a7ecf3b86b3d27359b0e8266a95bc0
|
|
| MD5 |
0322703c6335da4c76bd6c2fcb242643
|
|
| BLAKE2b-256 |
a406a89e6ca8084140ecc938e5e14991e75a8036959dd04452c6f0be7a3ac01e
|