Creating & distributing a new Plone/PyPI product

It’s amazing to see how technologies can be so smoothly integrated these days.  I’m talking, at least in this instance, about how setuptools works with PyPI (and then Plone.org’s Products section) and allows you to distribute your product(s) to the world.  So far, I’ve just got the one — collective.portlet.googleapps — but I’m sure time will pass and I’ll have some more useful things to contribute. Here’s a summary of what I did:

  1. Create the product.  ZopeSkel is a wonderful help here for Plone products. [I lie a little bit in my code example, because sadly, the plone3_portlet template doesn’t have nesting.  I cheated by using the Archetypes template and copied in my portlet code & repeated to create multiple portlets in one product]:

    easy_install-2.4 ZopeSkel
    paster2.4 create --list-templates
    paster2.4 create -t plone3_portlet collective.portlet.googleapps
    
  2. Upload it to some relevant code repository.  I’ve used the Plone collective SVN (and this guide):

    svn mkdir https://svn.plone.org/svn/collective/collective.portlet.googleapps -m 'Created new project'
    svn mkdir https://svn.plone.org/svn/collective/collective.portlet.googleapps/{trunk,branches,tags} -m 'Added base files'
    svn co https://svn.plone.org/svn/collective/collective.portlet.googleapps/trunk collective.portlet.googleapps
    [copy stuff into the folder]
    svn ci
    
  3. Do some work.  When you’re happy, make a tag for the relevant release version:

    svn copy https://svn.plone.org/svn/collective/collective.portlet.googleapps/trunk https://svn.plone.org/svn/collective/collective.portlet.googleapps/tags/0.1
    
  4. Sign up for PyPI (Python Package Index), generate a GPG key, and add the key ID to your account profile page.  Your key ID can be found on this line after generation:

    gpg: key XXXXXXXX marked as ultimately trusted
    

    or otherwise through gpg —list-keys

  5. Sign up for an account on Plone.org to allow you to upload your product here too.  Make sure you follow the URL you get emailed and change your password.

  6. Edit your ~/.pypirc file to include the following details from this page.  My file also needed the server-login section (something to do with differences between PyPI and Plone.org, I think).:

    [server-login]
    username:XXX
    password:YYY
    
  7. When ready, you can upload your work to PyPI and Plone.org:

    easy_install-2.4 collective.dist
    python2.4 setup.py register sdist bdist_egg upload -s
    python2.4 setup.py mregister sdist mupload -r plone.org
    
  8. If everything goes according to plan, then you should see ‘Response 200’ back from the servers.  If not, then check the following:

    1. Your passwords and user names are correct in your ~/.pypirc file (yes, it’s true, they’re plaintext…)
    2. Make sure your accounts on both PyPI and Plone.org are active and actually exist.
    3. You’ve followed any further instructions about troubleshooting on the links I’ve posted.
  9. Once done, you should be able to see your package on PyPI (and administrate it once logged in), and see your product on Plone.org. Keep in mind that Plone.org has an approval process that you’ll have to wait for before your product is fully visible.

Go Top
comments powered by Disqus