home-assistant-libs / pychromecast

Library for Python 3 to communicate with the Google Chromecast.
MIT License
2.51k stars 380 forks source link

Replace named tuples with frozen dataclasses #787

Closed emontnemery closed 6 months ago

emontnemery commented 6 months ago

Breaking change

The types CastStatus, MediaImage, LaunchFailure, MultizoneInfo, MultizoneStatus, DeviceStatus, CastInfo, ServiceInfo, NetworkAddress, ConnectionStatus are now dataclasses.dataclass.

Change

Replace named tuples with frozen dataclasses

Rationale: Named tuples can't be type annotated, this change is needed to add type annotations to pychromecast. Instead of changing to typing.NamedTuple, change to dataclasses.dataclass which is much more versatile.