Menu ▾ ▴

newbie packages, eclipse and pythonpath?

2009-03-25
2013-03-15
  • Matthew Jackson

    Matthew Jackson - 2009-03-25

    I'm new to using Eclipse and Pydev plugin.
    One nice thing that has made python quick to pick up is the simplicity of it and how similar developing is to running your code.
    In Eclipse and Pydev I've made several packages, but each package has it's own directory structure of PackageName\src\scriptfile.py.

    Lets say I have two packages "Application" and "Library".  Within each I have a src folder that contains the python scripts and python packages.  So if I have a script in "Application" called Main.py and it relies on a class "Window" in a script window.py that is in a python package that is at Library\src\UI.  In Eclipse I can go to the properties of the Eclipse "Application" package and say that it has a project reference to the Eclipse package "Library".  I can now in my Main.py script use the line
    from UI.window import Window
    and use it just as I would in normally in python.

    This works well in the Eclipse IDE but what do I do if I want to run this script outside of Eclipse?  What if I want to distrbute the library and python scripts that use the library to other machines? 

    Is there a build tool that is used to build the projects from the eclipse environment and place all scripts into appropriate directories for running outside of eclipse?

    Does most python development in Eclipse get done in just one Eclipse package?

    I've heard that Eclipse as a steep learning curve, but I want to try and stick with it.

    Matt

     
    • Fabio Zadrozny

      Fabio Zadrozny - 2009-03-26

      You can simply distribute your code as a .zip file with the proper package structure inside it  (or if you want an executable, you can use py2exe).

      The structure executing inside or outside Eclipse/Pydev is the same as through a shell (the only thing is that Pydev configures your PYTHONPATH based on the source folders/external source folders provided, while in the shell you have to config the PYTHONPATH setting the environment variable).

      Cheers,

      Fabio