[Distutils] Accessing package data files in wheels
Paul Sokolovsky
pmiscml at gmail.com
Mon Jun 29 08:56:04 CEST 2015
Hello,
On Sun, 28 Jun 2015 13:02:40 +0100
Paul Moore <p.f.moore at gmail.com> wrote:
> On 27 June 2015 at 19:52, Justin Uang <justin.uang at gmail.com> wrote:
> > What is the recommended way to get access to a data file in my
> > package if I'm using a wheel? pkg_resources seems like it's mainly
> > useful because eggs might be used in a zipped form, but for wheels,
> > I'm guaranteed that the data will be unpacked into a directory
> > structure right? In that case, should I just use __file__ to
> > manually find the location of the file?
>
>
> If you want to avoid a dependency on pkg_resources, you can use
> pkgutil.get_data (from the stdlib). It doesn't have as many features
> as pkg_resources, but it does the job in straightforward cases.
Which makes everyone in the audience wonder: how it happens that it's
2015, Python is at 3.5, but pkgutil.get_data() is in stdlib, while
pkg_resources.resource_stream() isn't? An implementation of
pkgutil.get_data() would be based on pkg_resources.resource_stream(),
or would contain just the same code as the latter, so it could easily
be exposed, and yet it isn't.
[]
--
Best regards,
Paul mailto:pmiscml at gmail.com
More information about the Distutils-SIG
mailing list