What is the difference between a "source folder" and a "pydev package" in PyDev Eclipse?

alwbtc picture alwbtc · Aug 31, 2013 · Viewed 10.5k times · Source

What is the difference between a "source folder" and a "pydev package" in PyDev Eclipse?

Menu options for creating new item in PyDev

Answer

Michael Herrmann picture Michael Herrmann · Aug 31, 2013

A "source folder" is a directory that contains source files. Putting .py files into this directory will make them discoverable by PyDev, so that you can for instance import them from other Python files.

A "PyDev Package" is a Python package. This means that it contains a file called __init__.py. For example, if you create a new PyDev Package with name foo, then you will get file foo/__init__.py. You can place other .py files into foo/, which you can then import. So, if you place bar.py into foo/, then you can do

import foo.bar

This is not possible with source folders.

You normally place packages into source folders. I don't know if it is possible to place a source folder into a package, but even if it were you would hardly ever do it.