Skip to main content

linc-device-kit

Plain data types for tools that drive Android and iOS devices: an accessibility-tree node, a screen snapshot, device identity, and the IDeviceIO protocol a device adapter implements. Pure dataclasses with no I/O and no dependencies, so an MCP server, a test harness and a quality checker can share one vocabulary and one compact JSON shape. nerve uses it.

Install

pip install linc-device-kit        # or: uv add linc-device-kit

Python 3.12+. No runtime dependencies.

Example

import json

from linc_device_kit import (
    DeviceInfo, DeviceType, ElementNode, Platform, Rect, ScreenState, SemanticRole,
)

login = ElementNode(
    id="login", text="Sign in", role=SemanticRole.BUTTON,
    bounds=Rect(x=40, y=900, width=400, height=96), clickable=True,
)
root = ElementNode(role=SemanticRole.CONTAINER, children=[login])
state = ScreenState(
    device=DeviceInfo("emulator-5554", Platform.ANDROID, DeviceType.EMULATOR),
    timestamp="2026-10-01T12:00:00Z",
    elements=root,
    foreground_app="com.example.app",
)

payload = state.to_dict()  # compact: fields at their defaults are omitted
print(json.dumps(payload["elements"]))
print(payload["element_count"])
assert ScreenState.from_dict(payload) == state
$ python example.py
{"role": "container", "children": [{"id": "login", "text": "Sign in", "role": "button", "bounds": {"x": 40, "y": 900, "width": 400, "height": 96}, "clickable": true}]}
2

ElementNode.to_dict() leaves out every field that is at its default, which keeps an accessibility tree small enough to hand to an AI agent. from_dict restores the defaults, so from_dict(to_dict(x)) == x. ScreenState.to_dict() never includes the screenshot bytes.

What is in it

Type What it holds
ElementNode One accessibility-tree node: id, text, description, value, role, bounds, clickable/enabled/focused/scrollable/checked, children
ScreenState A screen at a point in time: device, ISO 8601 timestamp, element tree, optional screenshot bytes, foreground app, screen name; element_count is computed from the tree
DeviceInfo Serial, platform, device type, model, OS version
Rect Axis-aligned bounds: x, y, width, height
Platform, DeviceType, SemanticRole StrEnums, so they serialise as plain strings
IDeviceIO @runtime_checkable protocol: screenshot, elements, foreground_app, logs, tap, swipe, type_text, press_key, install, launch, kill, clear_app_data, grant_permission, forward_debug_port, list_debug_targets, capabilities
DeviceKitError Base of the exception hierarchy (DeviceNotReachable, DeviceNotConfigured, InstallFailed, BuildFailed, SigningError, WDAStartupFailed, QualityGateFailed)

Development

uv sync --all-extras
uv run pytest

How this repo works

This is a release mirror of a private LINC repository. The code is built by LINC's AI software factory under human review, and each release lands here as one commit. Issues are welcome; see CONTRIBUTING.md. To report a security problem, see SECURITY.md.

License

Apache-2.0. See LICENSE and NOTICE.


Built by LINC Innovations. We diagnose flaky device test suites.

Metadata

Release files for linc-device-kit 1.0.0

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

Source distribution (sdist)

Source distribution for linc-device-kit 1.0.0
File Size Uploaded
linc_device_kit-1.0.0.tar.gz 14.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for linc-device-kit 1.0.0
File Interpreter ABI Platform
linc_device_kit-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 26.3 kB

Release files / linc_device_kit-1.0.0.tar.gz

Download URL linc_device_kit-1.0.0.tar.gz
Size 14.8 kB
Tags Source
SHA-256 checksum
How to use checksums
b251cb316a282214fa9ee196eeddbda49db810661dc6a3c4f772675d853e5b5f
BLAKE2b-256 checksum
How to use checksums
a45288d701faa5355b70ac8ea154fcc89ccb931bcd4673b32aef1b8f3be2a34c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 2, 2026.

Transparency log

Release files / linc_device_kit-1.0.0-py3-none-any.whl

Download URL linc_device_kit-1.0.0-py3-none-any.whl
Size 11.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6e46b9c344ce220dfd899afc13e7d2f55c3a485a0fdc02c59fe7482c716c79e9
BLAKE2b-256 checksum
How to use checksums
41ac7d96a6b4095050fb8880bcb8edcb3eabb96537f82a7c588d6a5d25b03956
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 2, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

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