Oh right, I remember you asking about that and I didn't immediately know
jrobeson
oh.. that musta been fallout from using import unicode_literals
sampsyo
Yeah, that must be the explanation
jrobeson
i think that commit should just straight up be reverted
sampsyo
Yes, exactly—this is a perfect case of needing "native strings"
(i.e., bytes on 2, unicode on 3)
jrobeson
i think reverting it would work
sampsyo
me too
jrobeson
can you do it?
sampsyo
Sure.
jrobeson
so, in python3 .. bytes cannot be used as keyword args
sampsyo
Makes sense.
jrobeson
is there any paritcular reason out_type in mediafile.py really needs to be b'out_type' ?
there are a lot of weird places where b is used .. that i don't understand why
sampsyo
That's weird
NOTICE: [beets] sampsyo pushed 1 new commit to master: https://github.com/beetbox/beets/commit/71b9fd785c0468c61214363ad138f115375b10f5
NOTICE: beets/master 71b9fd7 Adrian Sampson: Revert "Do __name__ comparison with bytes and not unicode"...
jrobeson
like os.platform() .. the output isn't bytes
sampsyo
I'm guessing that was another sad unicode_literals casualty
Here's my guess:
jrobeson
this is the biggest problem with the port
sampsyo
Python 2, of course, uses bytes for kwargs. Therefore, `kwargs.get(u'foo')` wouldn't work—and it was the default with unicode_literals.
So to patch things up and "make it work", somebody made it b''.
But that, of course, only works on Python 2.
If only we'd never done the whole unicode_literals thing…
jrobeson
atm.. the base commit on my local py3 branch is just a naive replace all unicode() with str() .. and that's been enough to get to the point where we get passing tests (beyond the b'out_type')
sampsyo
Cool!
jrobeson
i titled it convert all unicode() to str() .. pick up pieces later
plus all the previous commits that were acceptable to py3
err py2
well unicode_literals were needed.. until they decided to allow u''!
sampsyo
Perfect. If that's the bulk of the work, then using `from some_compat_lib import string_type` should work for the transition.
Right. IMO requiring 3.3 seems fine to me, though.
jrobeson
i don't think that's the bulk of the work to pass all the tests. that's just to get to the point where anything loads at all
sampsyo
Aha, great.
jrobeson
currently beets loads too many things before the tests happen
the lazy config really needs to be wrapped in a function
atm it's instantiated right when you import beets
sampsyo
It shouldn't be… the idea is that it doesn't do anything until you actually need it.
jrobeson
then there's something else calling it too soon
sampsyo
Yeah, probably so.
That lazy config loading thing is kind of a hack, though—I'd love to replace it with something more sensible.
jrobeson
that was the hardest thing for awhile
just to get to the point where the tests even run
sampsyo
It's kind of a trade-off between the convenience of being able to say `config['setting']` anywhere, without threading through an explicit object, and the predictability of passing through the configuration.
jrobeson
i'd much rather pass through the configuration, unless it really is that unwieldy. but i'm not trying to mess with that
not until i get a better handle on the codebase
sampsyo
Yeah, it's probably out of scope for the py3 transition.
jrobeson
so what's the deal with all the tests failing on windows?
i mean appveyor
it sounds like beets should right now run on windows based on the docs, but does it?
sampsyo
Things mostly work fine on Windows, but there are some problems with the test harnesses.
jrobeson
i'm not sure if we can really trust this py3 conversion until that is solved :(
sampsyo
One of the big ones has to do with sqlite being shared between threads, which is apparently not allowed on Windows?
jrobeson
well the most of the first errors have to do with module has no attribute edit or something like that
is it possible to run beets without any threads?
just block on everything
it'll be slow, but at least it will work.
what windows doesn't like, is multiple things acting on the same file
sampsyo
You can turn off threading via the configuration—worth a try.
jrobeson
well the module edit thing is probably something else (unless you can see why otherwise)
in regards to pathlib.. it would make things easier, but with the backport being in bad shape.. i'm trying to punt on it until we drop py2.. unless it becomes untenable
uggh.. this bytes thing is gonna be a real killer :(
so, i'm wondering why the py3 port hasn't been the main focus of the project for awhile?
i guess that's what i get for spending so much time with py3
i personally find py2 not really worth dealing with at all
as a user of a py2 script. it's not so bad
but as a coder :(
so, on to more important questions
sampsyo
On that last thing: the explanation is pretty standard
jrobeson
six or future
sampsyo
It's just that we all have a finite amount of attention to bring, so we can't do everything. Not an exciting explanation, but it's the truth!
jrobeson
i'm only doing it because I just don't want to do anything else on beets until it's py3
sampsyo
Good motivation. :)
jrobeson
untitaker, didn't wanna six (or anything else) as a dependency until py3 works already
i didn't get a chance to ask him why he said that.. and i certainly don't understand the reasoning
i'm trying to do this in such a way that if i get too busy.. the codebase will still be one step closer to py3 .. without all the work stuck in a bitrotten branch
sampsyo
I don't have strong feelings about that, except that we add a dependency with plenty of warning for packagers.
jrobeson
how does that happen?
wouln't it just come to their attention when they try to package it?
obviously it' be in the changelog
sampsyo
Mainly, add a dependency right after another release (and announce it on the mailing list) so they can prepare
(and test)
jrobeson
so, is there some python decoration thing for deprecated functions/methods ?
there are 4 deprecated functikons in confit, however the codebase was never actually adapted
i don't think things should be allowed to be deprecated unless all callers in the same codebase are dapted
adapted*
sampsyo
There's a DeprecationWarning class in warnings; we could try that.
jrobeson
there's lots of places where we need to import config.StrSeq
confit*
sampsyo
Right.
jrobeson
so what's the rules in import *
sampsyo
Avoid it except for special cases—it makes it hard to see where a name came from.
jrobeson
so.. back to the other question.. six or future ..
i was originally leaning towards future as it looks more useful.. however the bug tracker doesn't fill me with confidence
and there was definitely an important fix (regarding their new bytes type) that isn't in any release yet
sampsyo
I really couldn't tell from looking why one would be better than the other
One supports more versions, but they're versions we don't need
Good point about bugs though!
jrobeson
the library we choose for this is of the utmost importance
it affects too many things fur os not to be concerned
sampsyo
Indeed, I just honestly can't tell which is better
jrobeson
future is definitely better to me.. if the bug tracker wasn't so concerning
whichever one we pick.. i really don't think it will stick around too long though