I have a class in a different module and I want to show a DeprecationWarning when that class is imported. What will be the right way to do so?
DeprecationWarning
module 1
The import will execute the class definition, so put the warning there:
class Test: raise DeprecationWarning('This class is deprecated')