-
Notifications
You must be signed in to change notification settings - Fork 0
Python3
I'm in the process of porting the entire beets codebase and its dependencies to Python 3.x.
To ease the transition, I'm using a few coding conventions. I'm targeting Python 2.7 as a minimum version, so many Python 3-like structures are available. In particular, these __future__ imports are used to make the code as 3-esque as possible:
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
from __future__ import absolute_imports
The first two are implemented now across the codebase. The third one is almost everywhere and raises an error from time to time (it got added throughout the codebase in January 2015). I'm also using except A as B: instead of except A, B:. I'm slowly transitioning to str.format() instead of the % operator (I find this kind of formatting easier to read anyway).
One eventual hurdle: I'm currently using the buffer object to force SQLite to store byte strings in the database. In 3.x, you just use bytes objects instead of buffers to accomplish this.
Mutagen and Munkres will need help porting to Python 3. Mutagen is a large codebase and will need significant effort here. (Unidecode seems to already be compatible and python-musicbrainz-ngs is on its way to compatibility.) Audioread and pyacoustid also need porting.