In Django I have a package that issues a deprecation warning. sHow to make sure that the warning described where the import was being made from, so the coder can go in and change the file without having to step through code to find it?
So the general case is
#file1.py
import file2.py
#file2.py
import warnings
warnings.warn(
'Package deprecated: imported from %s' % __importer__,
DeprecationWarning
)
Where __importer__ is an imaginary attribute containing "file1.py", or some such reference.
Can anyone help me with this?