On 3 February 2017 at 15:33, René Dudfield <ren...@gmail.com> wrote:

> I think this API is simple, and it's possible to do a fairly good
> implementation and a very quick easy implementation in time for pyweek.
>
> Perhaps we can have a namespace package pygame.resources, released on pypi
> as pygame_resources. Or maybe include it in a 'skellington' package? If so,
> what should that package be called?
>

I think that API looks reasonable. I'd do it in 'skellington' for now and
let game creators play around with it before it becomes 'official'.

My understanding of namespace packages is that all the pieces that use it
have to agree on what is a namespace package, so we can't make pygame a
namespace package, because we already use it as a regular package. My
experience with the 'backports' namespace package is that it's not worth it
anyway - when it goes wrong, it's horrendously confusing and tricky to fix.
So as and when it becomes a package, I'd just let people import it as
'pygame_resources'.


> Ok, I am happy to avoid pkg_resources. Does it give us anything at all?
>

I think it does give some stuff, e.g. its data loading routines know about
zipped egg packages. However, I also think eggs should be avoided.

Setuptools (which pkg_resources is part of) has a particular way of seeing
packages - for instance, it can handle different versions of the same
package installed in the same environment - but that view conflicts with
the model most Python programmers now favour, based on pip+virtualenv. I
think setuptools makes sense if you buy into its view entirely, but if you
don't, it makes things opaque and complex for little apparent benefit.

> Here's the pyglet approach to resources loading.

That's quite neat. I disagree with the way it privileges the launcher
script, which I often don't have in a consistent relationship with the data
files, but I like that you can use a package directory. I would probably do
something like this:

from pyglet.resources import Loader
resources = Loader('@' + __name__ + '/data')  # resources in mygamepkg/data

Reply via email to