I am reviewing a .py file with no classes, just a list of functions. There is a newer version of this same file which is now used instead of the old file.
I know to mark class or function as deprecated, one can do from warnings import deprecated and then for the decorated function or class use deprecated("Do not use this")
There is not a 1-1 correspondence, so marking all the functions as deprecated individually seems weird. I could wrap the code in a class, deprecate this newly created class, and be done with it. However, it would be more natural to have a single annotation at the top of the page saying the entire contents of the file are to be ignored.
I could also create a new package, say deprecated, and move it there, but I would rather it keep the code in its original location.
So is there a pythonic way to mark an entire file as deprecated?
You could raise a DeprecationWarning at the top of the file. So it is issued whenever it is imported.