[Distutils] How to handle launcher script importability?

Donald Stufft donald at stufft.io
Wed Aug 21 12:29:18 CEST 2013


On Aug 21, 2013, at 6:17 AM, Paul Moore <p.f.moore at gmail.com> wrote:

> On 21 August 2013 10:48, Donald Stufft <donald at stufft.io> wrote:
> I think Wheel files are (and should be) independent of the particular metadata version used. That file should contain the required information in order to know what version of the metadata is included with the Wheel. This means that as metadata evolves Wheels can just start using the new meta data version without requiring an update to the spec.
> 
> That implies that any wheel reference implementation needs to expose APIs for reading and writing the metadata to/from the wheel. I don't have a problem with that, but I don't think the existing implementations do[1]... (And it could be a bit of a beast to design such an interface in a sufficiently future-proof manner, unless we also standardise a metadata object type...) Specifically, if I have a wheel and want to introspect it to find out the author email address, how do I do this? ("Doing so is not supported" is a valid answer, of course, but should also be documented...)
> 
> Paul
> 
> [1] Just checked. Distlib doesn't. Wheel doesn't (and wheel doesn't even have a fully documented API). Pip's wheel support is purely internal so doesn't count.


Yes I believe there should be an API for reading/writing to the dist-info directory and that's how a Wheel API should handle exposing that. It means you can compose api's so you have 1 API for reading/writing metadata which can be used for Wheels, Sdist 2.0, The on disk installed database format etc.

Quick off the cuff design of an API for introspecting the author email address (Please realize this is totally off the top of my head and has not been thought through or played with or explored or anything that would make it reasonable to actually expect it to be sane for more than this simple example).

>>> from ref import Metadata
>>> from ref import Wheel, Sdist2

>>> whl = Wheel.from_file("something-something.whl")
>>> print(whl.dist_info)
{"METADATA": "…", "entry_points.txt": "…"} 
>>> meta = Metadata.from_mapping(whl.dist_info) 
>>> print(meta["summary"])
"A Something or Other Library"
>>> sdist2 = Sdist2.from_file("something-something.sdist2")
>>> print(sdist2.dist_info)
{"pydist.json": "…", "README": "…"}
>>> meta = Metadata.from_mapping(sdist2.dist_info)
>>> print(meta["summary"])
"A something or Other Library"




-----------------
Donald Stufft
PGP: 0x6E3CBCE93372DCFA // 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20130821/f093bd25/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20130821/f093bd25/attachment.sig>


More information about the Distutils-SIG mailing list