pyatv
A client library for Apple TV and AirPlay devices
What it is and what it does
pyatv is an asyncio-based client library for interacting with Apple TV devices (all generations including tvOS 15+) and AirPlay-compatible receivers like HomePods and AirPort Express. It exposes a Python API for remote control, metadata retrieval with push updates, audio streaming, app management, account switching, and device configuration. The library ships with a command-line tool (`atvremote`) for discovery, pairing, and one-off commands, and supports persistent credential storage.
The package targets developers building home automation, media control, or device management applications. It handles the complexity of Apple's proprietary protocols (MRP, DMAP, DACP, RAOP) internally, exposing a clean async interface. With 13 runtime dependencies including aiohttp, cryptography, and zeroconf, it trades some dependency weight for protocol robustness and network discovery. Active maintenance and no known vulnerabilities make it suitable for production use.
Use it for:
- Build a home automation dashboard that discovers and controls multiple Apple TVs and AirPlay speakers on the local network.
- Stream audio files to HomePods or AirPort Express speakers programmatically from a Python application.
- Create a remote control app that mirrors Apple TV playback state and allows pause/play/skip operations.
- Automate app launching and account switching on Apple TVs for testing or multi-user household scenarios.
- Monitor and log currently-playing metadata (title, artist, position) from Apple TV devices in real time.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
An asyncio Python library for controlling Apple TV and AirPlay devices, supporting remote commands, metadata retrieval, audio streaming, app management, and account switching across tvOS 15+ and compatible receivers.
Yes. Active maintenance, low install friction, no security vulnerabilities, and permissive MIT license make it a solid choice for Apple TV and AirPlay automation. The 13 dependencies are all stable and widely-used. Install if you need to control or stream to Apple devices; the CLI tool alone is useful for discovery and one-off commands.
Install
pyatv on PyPI
pip
pip install pyatvuv
uv add pyatvpoetry
poetry add pyatvInstalling pyatv
Before you install
Low install friction with a pure-Python wheel. Active maintenance with a recent release (56 days ago) and ongoing commits. Depends on 13 runtime packages including aiohttp, cryptography, and zeroconf—all stable, widely-used libraries with no known friction.
License in practice
MIT license permits unrestricted use, modification, and distribution in both open-source and commercial projects with minimal obligations.
Quickstart
pip install pyatv
atvremote wizard
# or programmatically:
import asyncio
import pyatv
async def main():
atv = await pyatv.connect('10.0.10.254')
await atv.remote_control.play()
asyncio.run(main())
Requires Python 3.9 or later. Device discovery and pairing require network access to the same subnet as Apple TV or AirPlay devices.
Verify before relying
- Exact scope of tvOS 15+ support and any known compatibility gaps with newer tvOS versions.
- Performance characteristics when controlling multiple devices concurrently.
- Whether all AirPlay receiver types (HomePod, AirPort Express, third-party speakers) have feature parity.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.9.0) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 13 — aiohttp, async-timeout, cryptography, chacha20poly1305-reuseable, ifaddr, miniaudio, protobuf, pydantic, requests, srptools, tabulate, tinytag, zeroconf |
| Maintenance | actively maintained — 56 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 147,669/month — #11,054 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pyatv-0.18.0-py3-none-any.whl
Keywords: apple, tv, airplay, raop, companion, dmap, dacp
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
aiowebostvAsync Python library for controlling LG…
permissive · top 15,000 on PyPI
samsungtvwsA Python library for remotely controlling…
copyleft · top 15,000 on PyPI
pybraviaProvides an async Python interface to control…
permissive · top 15,000 on PyPI
rxvrxv discovers and controls Yamaha AV receivers…
permissive · top 15,000 on PyPI
sonos-websocketAsync Python library for communicating with…
permissive · top 15,000 on PyPI
denonavrProvides async control and monitoring of Denon…
permissive · top 15,000 on PyPI
rokuecpAn asynchronous Python client for controlling…
permissive · top 15,000 on PyPI
directvAsynchronous Python client for controlling and…
permissive · top 15,000 on PyPI
wiimwiim provides a Python API to discover,…
permissive · top 15,000 on PyPI
aiopvapiAsync Python API client for PowerView motorized…
permissive · top 15,000 on PyPI