ARTICLE AD BOX
I'm working on a project that has a somewhat complicated package layout. Specifically, there's a setup.py file at the top level of the project's directory tree that's as follows:
from setuptools import setup setup( name='ksoc2', version='0', packages=['ksoc2.common', 'ksoc2.common.src.main.python.math.robust_polyval', 'ksoc2.common.src.main.python.utils', 'ksoc2.models', 'ksoc2.models.src.main.python.flatFieldModel', 'ksoc2.models.src.main.python.gainModel', 'ksoc2.models.src.main.python.prf', 'ksoc2.models.src.main.python.raDec2Pix', 'ksoc2.models.src.main.python.readNoiseModel', 'ksoc2.models.src.main.python.saturationModel', 'ksoc2.models.src.main.python.wellDepthModel', 'ksoc2.pa', 'ksoc2.pa.src.main.python', 'ksoc2.tad', 'ksoc2.tad.src.main.python'], package_dir={'' : '.', 'ksoc2.common' : 'common', 'ksoc2.models' : 'models', 'ksoc2.pa' : 'pa', 'ksoc2.tad' : 'tad'}, package_data={'ksoc2.common' : ['src/main/python/utils/data/*'], 'ksoc2.models' : ['src/main/python/saturationModel/data/*', 'src/main/python/gainModel/data/*', 'src/main/python/raDec2Pix/data/*', 'src/main/python/readNoiseModel/data/*', 'src/main/python/wellDepthModel/data/*']}, include_package_data=True, url='', license='', author='PT', author_email='[email protected]', description='Packages for KSOC2', install_requires=['astropy', 'matplotlib', 'scipy', 'scikit-learn', 'numpy', 'astropy', 'spicepy', 'statsmodels'] )TL;DR: the top-level package has a bunch of formalism that allows it to incorporate packages that are several directory layers down from the top level. Each of the next-level-down directories (ksoc2.pa, ksoc2.common, etc.) has an __init__.py file that looks something like this:
from .src.main.python.process_background_pixels import * from .src.main.python.process_target_pixels import * from .src.main.python.fit_motion_polynomials import * from .src.main.python.perform_simple_aperture_photometry import * from .src.main.python.controller import * from .src.main.python.pa import *This setup allows pip install to do the right thing: when I install the ksoc2 package, it automatically puts all the files from all the ksoc2 subdirectories in the correct places, resolves the installation's required packages, etc. PyCharm also understands this configuration: when I edit, for example, a module in pa/src/main/python, its import statements are not flagged as unresolved.
Unfortunately PyDev doesn't seem to be able to understand this configuration, as when I look at, for example, a module in pa/src/main/python, it flags the imports from ksoc2.common as unresolved.
How do I get PyDev to correctly identify that those imports are actually in the ksoc2 package?
