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

315
views
0
6 months ago by

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.

Community: Wing Python IDE

2
6 months ago by
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

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.

written 6 months ago by Philip Bloom
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.
written 6 months ago by Wingware Support