PyEgg

Creating Python Eggs from NetBeans

This page reflects the work performed on Issue/Task #150283 which sought to enable creating Python eggs from NetBeans IDE for Python

Contents

Purpose

Create Python Egg from within NetBeans.

Use case in NetBeans

  • Right-click on the Python project name and select 'Build Egg'
  • A Python Egg should be created and deposited in a new sub-directory -'dist' with a default 'setup.py' which will be opened for the user to customise
  • Clean and Build Egg should be available

File:py-egg_PyEgg.png

  • If you already have a 'setup.py' file, and a do a 'Build Egg' it uses that. (Do a 'Clean & Build Egg' to create a default setup.py file)
  • The process can be tracked in the 'Output' TAB:

File:egg-op_PyEgg.png

  • Once the build process is over, you will see the the 'egg' has been deposited in the 'dist' directory (accessible in the 'Files' View)

File:pyegg-1_PyEgg.png

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

Assumptions

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

  • You have setuptools installed
  • Your setup.py file lives in the top level directory- src or your existing sources' root directory
  • 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

Notes

Creating Python eggs:

Basically Python eggs are created via a 4-step process

  1. Install setuptools.
  2. Create the files you want to be in your egg.
  3. Create a setup.py file.
  4. Run: python setup.py bdist_egg

For example:

$ cd /tmp
$ mkdir egg-example
$ cd egg-example
$ touch hello-egg.py

In this case, it will only contain an empty Python module named 'hello-egg.py'.

Next, create the simplest possible setup.py file:

from setuptools import setup, find_packages
setup(
    name = "HelloWorld",
    version = "0.1",
    packages = find_packages(),
)
python setup.py bdist_egg

Your Python egg should be ready in a new directory- dist

References

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo