New Python wrapper for libspotify

Today, after about nine months of working on it now and then, I uploaded the first alpha release of pyspotify 2.0 to PyPI.

pyspotify provides a Python interface to Spotify’s online music streaming service. With it you can access music metadata, search in Spotify’s library of 20+ million tracks, manage your Spotify playlists, and play music from Spotify. All from your own Python applications.

pyspotify 2.x is a full rewrite of pyspotify. I know you’re not supposed to rewrite anything from scratch, but I did it anyway, and I admit that it took way more time than I anticipated. But, there are some huge differences between 1.x and 2.x: pyspotify 1.x is a CPython C extension with some Python padding. It only works on CPython 2.6 and 2.7. It relies quite a bit on providing your own subclasses to get callbacks from the library, etc. pyspotify 2.x uses CFFI to wrap the libspotify C library, and is written in pure Python. It works on CPython 2.7 and 3.2+, as well as PyPy 2.1+. There is no subclassing of anything, and it can be quite comfortably used from an interactive Python shell.

This first alpha release of pyspotify 2.0.0 makes 100% of the libspotify 12.1.51 API available from Python, going far beyond the API coverage of pyspotify 1.x. So, if you’ve longed for writing your own Spotify client with offline support, now is the time.

pyspotify 2.x has an extensive test suite with 98% line coverage. All tests pass on all combinations of CPython 2.7, 3.2, 3.3, PyPy 2.2 running on Linux on i386, amd64, armel, and armhf. Mac OS X should work, but has not been tested recently. I know there are bugs, and I’d like to hunt them down. Thus, I’d love it if you would give pyspotify 2.x a spin and report any issues over at GitHub.

To get started, check out the installation instructions for some help on the C library part of the installation, then continue on with the quickstart guide, and finally the complete API reference.

Happy hacking!