homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author barry
Recipients alexis, barry, eric.araujo, pitrou, tarek
Date 2011年10月13日.17:56:22
SpamBayes Score 6.166567e-08
Marked as misclassified No
Message-id <20111013135619.18476be8@limelight.wooz.org>
In-reply-to <1318521693.13.0.517549681601.issue13167@psf.upfronthosting.co.za>
Content
On Oct 13, 2011, at 04:01 PM, Éric Araujo wrote:
>The PEP 376 implementation in packaging.database has been called ugly and
>opaque. When discussing PEP 396 for example (that’s why I’m adding Barry and
>Antoine to nosy, for their feedback),
>get_distribution(name).metadata['Version'] did not seem to agree with
>everyone. (Note that there are shortcuts for two metadata fields: name and
>version also exist as get_distribution(name).name / .version.)
I don't entirely remember my objections to the API, but I wonder if you
couldn't provide attribute access via properties on .metadata? Or are there
keys that can't be mapped to identifiers (modulo typical dash-to-underscore
mappings)?
>I’m not sure how we can make it less opaque, unless we force people to read
>documentation: PEP 376 proposes a database of installed distributions;
>packaging.database offers get_distribution, which returns an object with some
>attributes. I can’t have an outside view on this, so maybe you can explain
>what’s opaque and ugly so that we can try to improve it.
>
>I’ve found in distutils-sig archives from two or three years ago that people
>intended to offer a get_metadata function that would take a distribution name
>(i.e. pyOpenSSL, Babel, flufl.enum) and return a mapping object with the
>metadata read from the installed dist-info/METADATA file. Does that look
>better to you?
So, that would mean instead of
get_distribution(name).metadata['Version']
you'd use
get_metadata(name)['Version']
?
I'm not sure that's really buys you much.
Maybe we just need to live with the current API for a while before we try to
improve it.
History
Date User Action Args
2011年10月13日 17:56:23barrysetrecipients: + barry, pitrou, tarek, eric.araujo, alexis
2011年10月13日 17:56:22barrylinkissue13167 messages
2011年10月13日 17:56:22barrycreate

AltStyle によって変換されたページ (->オリジナル) /