skillfed

pyatv

A client library for Apple TV and AirPlay devices

pyatv v0.18.0 147.7K downloads/30d#11,054 on PyPI1,159
Permissive license MIT Active released

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 pyatv

uv

uv add pyatv

poetry

poetry add pyatv

Installing 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

Development Status :: 4 - BetaIntended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Topic :: Home AutomationTopic :: Software Development :: LibrariesTyping :: Typed

Tags

apple tv remote control libraryairplay streaming pythonhomepod audio streamingapple tv automation asyncioairplay receiver clienttvos device controlapple tv metadata api
home-automationairplayasyncio

More Libraries packages