First time here? Check out the FAQ!
1

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

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.

Philip Bloom's avatar
36
Philip Bloom
asked 2018-01-30 21:34:00 -0600
Wingware Support's avatar
4.2k
Wingware Support
updated 2019-03-13 08:48:06 -0600
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

1

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

Wingware Support's avatar
4.2k
Wingware Support
answered 2018-01-31 11:27:00 -0600
edit flag offensive 0 remove flag delete link

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's avatar Philip Bloom (2018-01-31 18:57:00 -0600) 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's avatar Wingware Support (2018-02-01 10:53:00 -0600) edit
add a comment see more comments

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss.

Add Answer