On a single machine, how can/should two versions of a single python module be used
(a) simultaneously on the same machine,
(b) under a single user, and
(c) without installing external programs (cant reliably install external stuff on Windows work computer, sadly),
(d) having the same name (to allow no pains when upgrading ($ git pull newversion
) )
A production version of a code project is running constantly. On the same machine, a test/development version of the code is also running periodically. How can they both use their own specific version of a given module?
Version A:
#!/usr/bin/python34
#C:\\myproject\\testversion\\bin\\myprogram.py
import mymodule ## this version in C:\\myproject\\testversion\\lib\\python
mymodule.do_stuff() # do_stuff version A
Version B:
#!/usr/bin/python34
#C:\\myproject\\productionversion\\bin\\myprogram.py
import mymodule ## this version is in C:\\myproject\\productionversion\\lib\\python
mymodule.do_stuff() ## do_stuff version B
Strictly using the PythonPath
environment variable would pick the same mymodule
do for both versions, if my understanding is correct.
After reading this question about different python modules, and the python docs about modules, I feel like properly organizing a package rather than just a module may be appropriate, but I can't quite tell what best practice would be from that.
Also, since I thought standard (best?) procedure for many projects such as deb packages etc. is to have scripts in a different folder than modules (e.g. bin vs. lib), it seems that the import
keyword just looking in the same directory is not sufficient for the above case.