Hatching Python Eggs from NetBeans

by Amit


Support for building Python eggs  (IZ #150283) from NetBeans IDE is now available in the repository. (Refer this link to see how you can clone the repository and build the Python bits). Please try it and file bugs and suggestions here

Now, I would like to talk a bit of Python Eggs and how to use the NetBeans IDE to build Eggs for your Python packages.

A Python Egg is to Python as JAR is to Java or a ‘gem’ is to Ruby. It comprises of your code, resources and all important metadata- version, dependency information, etc. All the gory details are here at http://peak.telecommunity.com/DevCenter/PythonEggs

Use case in NetBeans

  • Right-click on the Python project name and select ‘Build Egg’
  • If you already have a setup.py file (Please refer the ‘assumptions‘ section below) , and a do a ‘Build Egg’ it uses that. (Do a ‘Clean & Build Egg’ to create a default setup.py file. If you don’t have a setup.py, one is created for you
  • The process can be tracked in the ‘Output’ Tab
  • Once the build process is over, you will see the the ‘egg’ has been deposited in the ‘dist’ directory (accessible in the ‘Files’ View)

It is not viewable from the ‘Projects’ view as it unnecessarily clutters the view.

Egg Formats

As you can see from the above view, there is also a file, EggDemo.egg-info, which is another format for Python Eggs as mentioned in http://peak.telecommunity.com/DevCenter/EggFormats

The wiki page has some more information.

Assumptions

These have to assumed, because that is the way it has to be:

  1. You have setuptools installed
  2. Your setup.py file lives in the top level directory- src or your existing sources’ root directory
  3. Your packages or sub-packages (those containing __init.py__) are actually in the sub-(sub)-directories under your top-level directory, in which setup.py lives
Advertisement