salilab / imp

The Integrative Modeling Platform
https://integrativemodeling.org
GNU General Public License v3.0
74 stars 30 forks source link

python submodules in IMP #646

Closed Pellarin closed 10 years ago

Pellarin commented 10 years ago

How can I organize the python modules in pyext/src/ into subdirectories so that I can import them individually, or in a block? Is there anything particular I have to do so that the submodules are in the path?

For instance, my structure should be:

representation.py
tools.py
output.py
...
restraints/
        crosslinks.py
        proteomics.py
        stereochemistry.py
        ....
drussel commented 10 years ago

To summarize:

Pellarin commented 10 years ago

the directory is linked. I don't know if that is a bug but, the compiled python file of the original module restraints.pyc was still present in the lib/IMP/pmi/ directory even if the original file was removed from the source directory and I recompiled pmi. Since the directory was called in the same way, that I guess created a bit of a mess... I think that recompilation should get rid of old pyc files, if the corresponding source code is not present anymore.

drussel commented 10 years ago

Yeah, old pyc files are really annoying and I don't think one can nicely make pytgon ignore them. We clean them from the source dir, but not from the build dir. Probably should add that.

On Wednesday, December 11, 2013, Riccardo Pellarin wrote:

the directory is linked. I don't know if that is a bug but, the compiled python file of the original module restraints.pyc was still present in the lib/IMP/pmi/ directory even if the original file was removed in the source code and I recompiled pmi. Since the directory was called in the same way, that I guess created a bit of a mess... I think that recompilation should get rid of old pyc files, if they the original source codes are not present anymore.

— Reply to this email directly or view it on GitHubhttps://github.com/salilab/imp/issues/646#issuecomment-30381780 .

drussel commented 10 years ago

So is it working now? Close?

Pellarin commented 10 years ago

Sorry still trying.

Pellarin commented 10 years ago

Little note for the future:

get rid of nasty *pyc files in lib/IMP/module add __init__.py (also empty) in the subdirectory, and that should be all.

Can we add this in the documentation?

drussel commented 10 years ago

The pyc cleanup we should do. I'm not sure that significant subdirectory structure in the python scripts of modules is something we want to encourage :-)

On Wednesday, December 11, 2013, Riccardo Pellarin wrote:

Little note for the future:

get rid of nasty pyc files in lib/IMP/module add *init.py (also empty) in the subdirectory, and that's should be all.

Can we add this in the documentation?

— Reply to this email directly or view it on GitHubhttps://github.com/salilab/imp/issues/646#issuecomment-30385951 .