Alexis Métaireau | 23 May 2012 17:58
Gravatar

Distinguishing PEP 345 distributions from old ones.

Heya folks,

Do you know if there are any ways to distinguish PEP 345 based 
distributions from other ones (distutils1 or setuptools) , when hitting 
PyPI?

That could be useful to have a specific record in what's returned by 
PyPI so we are able to decide what to do with them from there.

Any idea? If that's not something already available, any concerns about 
a possible implementation?

-- Alexis
Tarek Ziadé | 23 May 2012 18:41
Favicon
Gravatar

Re: Distinguishing PEP 345 distributions from old ones.

On 5/23/12 5:58 PM, Alexis Métaireau wrote:
> Heya folks,
>
> Do you know if there are any ways to distinguish PEP 345 based 
> distributions from other ones (distutils1 or setuptools) , when 
> hitting PyPI?
>
> That could be useful to have a specific record in what's returned by 
> PyPI so we are able to decide what to do with them from there.
>
> Any idea? If that's not something already available, any concerns 
> about a possible implementation?
the metadata version, which is 1.2
>
> -- Alexis
> _______________________________________________
> Catalog-SIG mailing list
> Catalog-SIG <at> python.org
> http://mail.python.org/mailman/listinfo/catalog-sig
Alexis Métaireau | 24 May 2012 15:07
Gravatar

Re: Distinguishing PEP 345 distributions from old ones.

> the metadata version, which is 1.2

That doesn't seem to be available in PyPI direclty, nor via the XML-RPC 
interface: http://pypi.python.org/pypi/pelican/json

>>> import xmlrpclib
>>> client = xmlrpclib.ServerProxy('http://pypi.python.org/pypi')
>>> client.release_data('Pelican', '2.8.1')/keys()
['maintainer',
 'docs_url',
 'requires_python',
 'maintainer_email',
 'cheesecake_code_kwalitee_id',
 'keywords',
 'package_url',
 'author',
 'author_email',
 'download_url',
 'platform',
 'version',
 'cheesecake_documentation_id',
 '_pypi_hidden',
 'description',
 'release_url',
 '_pypi_ordering',
 'classifiers',
 'name',
 'bugtrack_url',
 'license',
 'summary',
(Continue reading)

Tarek Ziadé | 24 May 2012 15:26
Favicon
Gravatar

Re: Distinguishing PEP 345 distributions from old ones.

On 5/24/12 3:07 PM, Alexis Métaireau wrote:
>> the metadata version, which is 1.2
>
> That doesn't seem to be available in PyPI direclty, nor via the 
> XML-RPC interface: http://pypi.python.org/pypi/pelican/json
>
>>>> import xmlrpclib
>>>> client = xmlrpclib.ServerProxy('http://pypi.python.org/pypi')
>>>> client.release_data('Pelican', '2.8.1')/keys()

Weird, I could have swore it was in there. We should add the 
'metadata_version' key.

In the interim you can detect when it's a 1.2 because it has specific 
fields , by loading the metadata in a packaging.metadata.Metadata instance
and ask it to detect the version.

You can try with http://pypi.python.org/pypi/gitbuster/

(notice the UI that lists the dependencies)

Also, as discussed with Richard we said we would publish 'setup.cfg' in 
PyPI. So that will be another way

Cheers
Tarek
_______________________________________________
Catalog-SIG mailing list
Catalog-SIG <at> python.org
http://mail.python.org/mailman/listinfo/catalog-sig
(Continue reading)

Alexis Métaireau | 24 May 2012 15:49
Gravatar

Re: Distinguishing PEP 345 distributions from old ones.

Le 24/05/2012 15:26, Tarek Ziadé a écrit :
> On 5/24/12 3:07 PM, Alexis Métaireau wrote:
>>> the metadata version, which is 1.2
>>
>> That doesn't seem to be available in PyPI direclty, nor via the 
>> XML-RPC interface: http://pypi.python.org/pypi/pelican/json
>>
>>>>> import xmlrpclib
>>>>> client = xmlrpclib.ServerProxy('http://pypi.python.org/pypi')
>>>>> client.release_data('Pelican', '2.8.1')/keys()
>
> Weird, I could have swore it was in there. We should add the 
> 'metadata_version' key.
>
> In the interim you can detect when it's a 1.2 because it has specific 
> fields , by loading the metadata in a packaging.metadata.Metadata 
> instance
> and ask it to detect the version.
Oh, it seems that new distributions do have a "requires_dist" field, so 
I can use this and determine if it's a PEP 345 dist or not from there.

Well, I could if I had the metadata fields there, but they aren't 
present (PyPI doesn't do anything with the setup.py to get the metadata 
related fields it seems).

Using packaging/distutils2.metadata.Metadata to guess the version of the 
metadata is thus not working for me when getting this metadata from PyPI.

For instance:

(Continue reading)

Tarek Ziadé | 24 May 2012 15:55
Favicon
Gravatar

Re: Distinguishing PEP 345 distributions from old ones.

On 5/24/12 3:49 PM, Alexis Métaireau wrote:
> Le 24/05/2012 15:26, Tarek Ziadé a écrit :
>> On 5/24/12 3:07 PM, Alexis Métaireau wrote:
>>>> the metadata version, which is 1.2
>>>
>>> That doesn't seem to be available in PyPI direclty, nor via the 
>>> XML-RPC interface: http://pypi.python.org/pypi/pelican/json
>>>
>>>>>> import xmlrpclib
>>>>>> client = xmlrpclib.ServerProxy('http://pypi.python.org/pypi')
>>>>>> client.release_data('Pelican', '2.8.1')/keys()
>>
>> Weird, I could have swore it was in there. We should add the 
>> 'metadata_version' key.
>>
>> In the interim you can detect when it's a 1.2 because it has specific 
>> fields , by loading the metadata in a packaging.metadata.Metadata 
>> instance
>> and ask it to detect the version.
> Oh, it seems that new distributions do have a "requires_dist" field, 
> so I can use this and determine if it's a PEP 345 dist or not from there.
>
> Well, I could if I had the metadata fields there, but they aren't 
> present (PyPI doesn't do anything with the setup.py to get the 
> metadata related fields it seems).
that's done on client side when you call "register", it sends the 
metadata as a dict
see 
http://hg.python.org/distutils2/file/0291648eb2b2/distutils2/command/register.py#l220

(Continue reading)


Gmane