Re: faulty releases and pypi access [update]

Philipp von Weitershausen <[email protected]> Thu, 27 Sep 2007 13:37:29 +0200
Newsgroups gmane.comp.web.zope.zope3
Message-ID <[email protected]>
On 27 Sep 2007, at 12:20 , Stephan Richter wrote:
> egg_info does not validate the trove classifiers, for example. I  
> tried this
> last night before writing this mail.

Well, to be honest, I wonder how you can mess up with the  
classifiers. I just always copy them from http://pypi.python.org/pypi? 
%3Aaction=list_classifiers. Anything else is just insane...

But, if you wish for such a tool, let your wish be my command. With  
the attached verifyclassifiers.py script, you may do so using the  
following command:

   python setup.py --classifiers | python verifyclassifiers.py

> If the the setup.py file has a syntax error, I will know about it  
> when running buildout.

True, but running buildout can take a long time.

>> * You can generate an egg or a tarball locally, without uploading it.
>>   Then you can take a look at the tarball or the egg. Unzip it if  
>> necessary. Call
>>   python setup.py egg_info inside the tarball, if necessary, to  
>> see if all the
>>   CHANGES.txt, README.txt etc. files are there as well, especially  
>> when you know
>>   you messed this part up before.
>
> Still does not solve my problem use case.
>
>>    You could also easy_install the egg and/or tarball in a virtualenv
>>    (so that your global site-packages won't be affected).
>
> I still do not see how this solves the problem.

They're measures for making sure the distribution has the right  
metadata and is easy_install'able. What other problem do we have?
verifyclassifiers.py (text/x-python-script, 365 B)
import sys
import urllib2

url = 'http://pypi.python.org/pypi?%3Aaction=list_classifiers'
file = urllib2.urlopen(url)
valid_classifiers = file.read().splitlines()

for classifier in sys.stdin:
    classifier = classifier.rstrip() # cut of new line at the end
    if classifier not in valid_classifiers:
        print >>sys.stderr, "Invalid classifier:", classifier