Python imports for tests using nose - what is best practice for imports of modules above current package
I had the same problem and found an answer in a related question work for me.
Just remove the __init__.py in the project root.
You have answered your question pretty well already.. D (install to system location) is preferred for distributable code. I usually use C (modify sys.path) because I don't want system-wide installs of my hundreds of custom libs. In theory A (relative import) seems nicer, but there are cases where it fails. B (PYTHONPATH) is right out, really only for testing purposes in my opinion.
That pretty much sums up all of the options. The option you prefer (Python magically knows where to look) is really not a workable solution because it can lead to unpredictable results, such as automagically finding libraries from unrelated projects.
In my opinion, the best thing to do is put this at the entry point(s) to your program:
import sys, os
sys.path = [os.path.abspath(os.path.dirname(__file__))] + sys.path
I know there is a answer checked and I still think it's a good reason to share other alternatives :)
There is a nose-pathmunge giving you a control to set sys.path
while invoking nosestests
.