zmk-studio-api
zmk-studio-api is a Rust client for the ZMK Studio RPC API on ZMK keyboards.
It can read device and keymap state, and apply keymap changes over serial or BLE.
Additionally, this library includes Python bindings for API access from Python applications and scripts.
Usage
Rust
Add dependency with Cargo:
cargo add zmk-studio-api [--features ble]
Usage example:
use zmk_studio_api::{Behavior, HidUsage, Keycode, StudioClient, transport::serial::SerialTransport};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut client = StudioClient::new(SerialTransport::open("COM3")?);
let info = client.get_device_info()?;
println!("Device: {}", info.name);
println!("Lock: {:?}", client.get_lock_state()?);
let before = client.get_key_at(0, 12)?;
println!("Before: {before:?}");
client.set_key_at(0, 12, Behavior::KeyPress(HidUsage::from_encoded(Keycode::A.to_hid_usage())))?;
let after = client.get_key_at(0, 12)?;
println!("After: {after:?}");
if client.check_unsaved_changes()? {
client.discard_changes()?;
}
Ok(())
}
For a complete runnable example, see examples/basic_example.rs.
Python
Install from PyPI:
pip install zmk-studio-api
Usage example:
import zmk_studio_api as zmk
client = zmk.StudioClient.open_serial("COM3")
print("Lock:", client.get_lock_state())
before = client.get_key_at(0, 12)
print("Before:", before)
client.set_key_at(0, 12, zmk.KeyPress(zmk.Keycode.A))
after = client.get_key_at(0, 12)
print("After:", after)
For a complete runnable example, see examples/basic_example.py.
License & Attribution
This project is licensed under the Apache 2.0 license. Parts of this project are based on code from the ZMK Studio (Apache 2.0) and its TypeScript client implementation (MIT).
Metadata
Release files for zmk-studio-api 0.6.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| zmk_studio_api-0.6.1.tar.gz | 62.1 kB | Without provenance | Details for zmk_studio_api-0.6.1.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| zmk_studio_api-0.6.1-cp39-abi3-win_amd64.whl | CPython 3.9 | abi3 | Windows x86-64 | Details for zmk_studio_api-0.6.1-cp39-abi3-win_amd64.whl |
| zmk_studio_api-0.6.1-cp39-abi3-win32.whl | CPython 3.9 | abi3 | Windows x86-32 | Details for zmk_studio_api-0.6.1-cp39-abi3-win32.whl |
| zmk_studio_api-0.6.1-cp39-abi3-manylinux_2_34_x86_64.whl | CPython 3.9 | abi3 | Linux glibc 2.34+ x86-64 | Details for zmk_studio_api-0.6.1-cp39-abi3-manylinux_2_34_x86_64.whl |
| zmk_studio_api-0.6.1-cp39-abi3-macosx_11_0_arm64.whl | CPython 3.9 | abi3 | macOS 11.0+ ARM64 | Details for zmk_studio_api-0.6.1-cp39-abi3-macosx_11_0_arm64.whl |
| zmk_studio_api-0.6.1-cp39-abi3-macosx_10_12_x86_64.whl | CPython 3.9 | abi3 | macOS 10.12+ x86-64 | Details for zmk_studio_api-0.6.1-cp39-abi3-macosx_10_12_x86_64.whl |
Total release size: 1.7 MB
Release files / zmk_studio_api-0.6.1.tar.gz
| Download URL | zmk_studio_api-0.6.1.tar.gz |
|---|---|
| Size | 62.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
24327522be96f14be07d40a66c640befcbc991fa25ce4642da69ccd784c3f8c3
|
|
BLAKE2b-256 checksum How to use checksums |
dc49ee100a07c0b07deafe94eda8a891854fe05fbdfb050164187d36ccb73936
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / zmk_studio_api-0.6.1-cp39-abi3-win_amd64.whl
| Download URL | zmk_studio_api-0.6.1-cp39-abi3-win_amd64.whl |
|---|---|
| Size | 243.3 kB |
| Tags | CPython 3.9 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
afbbd15bfa04ad7e0924ef3af84fe1c18ff323e3c9ec83d98a36cd6cd08a35c9
|
|
BLAKE2b-256 checksum How to use checksums |
c597871510d052ca9460d42cb041c77c063e50a01b6d7ab4d58f6ce6c86967ba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / zmk_studio_api-0.6.1-cp39-abi3-win32.whl
| Download URL | zmk_studio_api-0.6.1-cp39-abi3-win32.whl |
|---|---|
| Size | 233.5 kB |
| Tags | CPython 3.9 Windows x86-32 abi3 |
|
SHA-256 checksum How to use checksums |
e6c05ceac1b83c255b4d9bbdd15cd64c86def7b676fe3d47246fddd8639aa268
|
|
BLAKE2b-256 checksum How to use checksums |
da46ea3a6e13dd74be423d9aec88ca489b99fe055e3cef3df7f84f913cf1ad92
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / zmk_studio_api-0.6.1-cp39-abi3-manylinux_2_34_x86_64.whl
| Download URL | zmk_studio_api-0.6.1-cp39-abi3-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 403.4 kB |
| Tags | CPython 3.9 Linux glibc 2.34+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
016afae8d33105c2c7ebe477bcaf8b49f73b0a3db74c3666226954bf5a0bec93
|
|
BLAKE2b-256 checksum How to use checksums |
8afe5c5b95a34f4dfb13d8b3d72f4dd6d07f4177bf82d92ab4fc829efc9936bf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / zmk_studio_api-0.6.1-cp39-abi3-macosx_11_0_arm64.whl
| Download URL | zmk_studio_api-0.6.1-cp39-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 361.8 kB |
| Tags | CPython 3.9 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
c042f20839737d9d829a0df567434219f1f4fabb5f1b486534d71c44df4d848f
|
|
BLAKE2b-256 checksum How to use checksums |
5e9812280d4560237aa921cca228c2b365e126f08f135376e0127173b896b19a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / zmk_studio_api-0.6.1-cp39-abi3-macosx_10_12_x86_64.whl
| Download URL | zmk_studio_api-0.6.1-cp39-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 354.9 kB |
| Tags | CPython 3.9 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
f55450573af2d9b0141458402455fe0be84fd78b721e2b2b9e4b56bc43fb42c9
|
|
BLAKE2b-256 checksum How to use checksums |
5adff8691dc0fad57a85bf68ead08e3e6bc6779c0fa328dfa2984fc48ea908c6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Security for zmk-studio-api 0.6.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.