0

I have two questions about python development with Eclipse+Pydev on a project that already has been set up to use "python setup.py install". It's a decent-size project (100+ python modules, 10+ packages).

Question 1: If I have multiple entry functions (i.e. different starting files to run my code) is it possible to have Eclipse+PyDev automatically run "python setup.py install" before executing any file in my project? Or is the best way just to have a line in the beginning of every starting file to run "python setup.py install"? I originally wanted to just do all of the development within Eclipse w/o having to do "python setup.py install" at all, but that requires changing the way the import statements are done across the project (see below more details about this).

Question 2: Suppose my project is named "X", whenever I press Ctrl+F3 to jump to a file containing a function definition, if that file is not already open in an editor, then Eclipse will open the "C:/Python27/Lib/site-packages/X/some-package/some-module.py" instead of the file ../UserMe/X/some-package/some-module.py. Is it possible to make it so that Eclipse knows to only access the local files and not the ones made from "python setup.py install" that are in the site-packages folder?

More Details:

Right now everything is "working" (i.e. compiling and running):

Currently, in order to run my project I do the following:

cd <top-level-dir>
python27 setup.py install
# then run my script
python27 startup/script1.py

Different kinds of imports

It seems that in Eclipse+PyDev there are two different ways of doing imports for my project. My project name is "X". If I'm not using "python setup.py install", and just running everything from within Eclipse, Eclipse seems to want my imports like the following

import package.module1
import package.module2
... etc

However, since I'm using "python setup.py install" I need to have my imports like the following:

from X.package import module1, module2

But when I do this, Eclipse+Pydev code analysis complains that my imports are broken unless I do "python setup.py install" before each run. So I end up just running "python setup.py install" and then my startup script in a terminal outside of Eclipse.

Other Details

  • Using python2.7

Thank you! I appreciate any tips relating to this. I consider myself new to big project development using python.

Dustin
  • 143
  • 2
  • 12

1 Answers1

1

I think you have gotten ahead of things with python setup.py install, what you want is python setup.py develop so that your code that you are developing is not installed, but instead special links are set-up.

See Python setup.py develop vs install and its answers too.

Community
  • 1
  • 1
Jonah Graham
  • 7,890
  • 23
  • 55