I have a module that I want to keep up to date, and I'm wondering if this is a bad idea:
Have a module (mod1.py) in the site-packages directory that copies a different module from some other location into the site-packages directory, and then imports * from that module.
import shutil
from distutils.sysconfig import get_python_lib
p_source = r'\\SourceSafeServer\mod1_current.py'
p_local = get_python_lib() + r'\mod1_current.py'
shutil.copyfile(p_source, p_local)
from mod1_current import *
Now I can do this in any module, and it will always be the latest version:
from mod1 import function1
This works.... but is there a better way of doing this?
Update
Here is the current process... there is a project under source-control that has a single module: mod1.py
There is also a setup.py
Running setup.py
copies mod1.py
to the site-packages directory.
Developers that use the module must run setup.py
to update the module. Sometimes, they don't and not having the latest version causes problems.
I want to be able to just check-in the a new version, and any code that imports that module will automatically grab the latest version every time, without anyone having to run setup.py