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

On 21 August 2013 11:30, Donald Stufft <donald@stufft.io> wrote:
On Aug 21, 2013, at 6:29 AM, Donald Stufft <donald@stufft.io> wrote:

introspecting the author email address

Of course I wrote that and then did summary because the location of the author email address changed between Metadata 1.x and 2.x and I didn't feel like looking up the exact difference.

:-)

So would you see the API for author being

if meta.version < (2, 0):
    author = meta["whatever_it_is_in_1.x"]
else:
    author = meta["whatever_it_is_in_2.x"]

(i.e., the metadata version would be available)?

Sounds like a sensible approach.

Paul.

Yes, and possibly some sort of compat shim could be made to smooth over the differences if it was felt to be warranted.

But in general I'm very much in favor of composed APIs instead of having things like WheelMetadata, Sdist2Metadata, InstalledDBMetadata etc. Less code and easier to switch out pieces (e.g. in your own code you wouldn't need to change the metadata handling based on if it was a Wheel or a Sdist2, just load the appropriate file type and pass the mapping into the Metadata api).

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