I am not sure that this is really possible but I would like to apply __getattr__ on a package (like PEP 562). We require this to report some module attributes as deprecated.
Unfortunately, this looks like that in such scenario __getattr__ is not called at all. How can we check that some package attribute was called?
here is a package structure:
my-app/
├─ package/
│ ├─ __init__.py
├─ run.py
├─ setup.py
run.py
import package
from package import b
print(package.a)
print(b)
__init__.py
a = 1
b = 2
def __getattr__(name):
print(name)