Monday, September 10, 2007

Python Cheeseshop and Eggs

I've been playing with putting a package up on the Cheeseshop, Python's Package Index. There isn't a lot of documentation out there, but there really doesn't need to be, it's pretty easy. I cheated and modified someone else's egg for my own use, but the file setup isn't all that hard, and you can get paster to make a ready-eggable template for you.

Anyways, the quick commands to use, after creating an account and setting up your egg and metadata:

  • python setup.py register
    this creates an entry in the cheeseshop for your project and populates it with the metadata from your egg. If something is wrong, just fix it and rerun this command.
  • python setup.py sdist upload
    this creates a source distribution (the egg folder tarred and gunzipped) in dist/ and uploads it to the cheeseshop
  • python setup.py bdist_egg
    upload this creates a binary distribution (the egg folder all zipped up) in dist/ and uploads it to the cheeseshop


Super bonus hints:
python setup.py develop installs the egg using a link to your source code instead of putting it in the site-packages folder, so you can test things.
easy_install -m package_name
takes the package name out of the appropriate places, allowing you to uninstall a package by deleting it from the site-packages folder.

No comments: