Ask Your Question
1

What is the right way to set up project python paths for sharing?

asked 2018-01-30 21:34:00 -0500

Philip Bloom gravatar image

updated 2019-03-13 08:48:06 -0500

We are starting to refactor a larger python project into subfolders (with __init__.py for packaging).  From:

BigFolder

To:

Bigfolder
    __init__.py
    files...
   /subfolder
        __init__.py
   files...
   /othersubfolder
       __init__.py
   files

What is the best to set at the project level, "Please presume Bigfolder should be scanned for autocomplete information for all files in subfolders"?    I can add a custom python path, but that isn't project relative and is stored in the user file (wpu) rather than the (wpr).  Ideally I want to make it easy for the team to refactor while not losing the excellent source data and autocompletion we presently enjoy or need them to manually add things to the project to get it.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2018-01-31 11:27:00 -0500

One way to do this is to put you main debug file in the same folder as Bigfolder.  This works because the directory that the main debug file is in is prepended to the python path.  You can also move the custom python path setting into the .wpr file by setting the proj.shared-attribute-names list as described in https://wingware.com/doc/proj/project-types

edit flag offensive delete link more

Comments

Thanks, was unaware of shared-attribute-names.   Will try that and it definitely moves us a step forward.  We generally use an initial folder outside as this is a framework that produces a lot of temporary data in the working directory (it's meant for build systems).  We also tend to have a lot of small scripts on the framework in the same project.  Is there a good way to prepend the project path to the python path?  That'd be taking it even better if possible.

Philip Bloom gravatar imagePhilip Bloom ( 2018-01-31 18:57:00 -0500 )edit

You can use the ${WING:PROJECT_HOME} pseudo environment variables to define your python path.  The project home defaults to the directory of the project file, but can be set to a another directory which is stored as a relative path.

Wingware Support gravatar imageWingware Support ( 2018-02-01 10:53:00 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2018-01-30 21:34:00 -0500

Seen: 8 times

Last updated: Mar 07