SoCo is a Python library for controlling Sonos speakers. It provides a simple interface to discover, query, and control Sonos devices over a local network. Current version 0.31.0 supports Python >=3.6, with releases approximately every few months.
Install & Compatibility
Where this runs
tested against v0.31.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.978s · 34.3MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 2.9s · import 0.864s · 35MB
33MB installed
● package 33MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
SoCo is a class, not a module
from soco import SoCo
Quickstart: import SoCo, create instance with IP, control playback, volume, and get track info.
from soco import SoCo
# Discover a speaker by IP (replace with your speaker's IP)
speaker = SoCo('192.168.1.10')
# Play music (e.g., a URI)
speaker.play_uri('x-rincon-mp3radio://stream.example.com:8000/stream')
# Adjust volume
speaker.volume = 30
# Get current track info
track = speaker.get_current_track_info()
print(track.title)
Upgrade
Version history
Breaking-change detection hasn't run for this library yet.
Audit
Security & dependencies
CVE tracking and dependency tree are planned for a later release.