On 2019-08-10, Serhiy Storchaka wrote:
Actually we need to distinguish the the author and the user of the code and show warnings only to the author. Using .pyc files was just an heuristic: the author compiles the Python code, and the user uses compiled .pyc files. Would be nice to have more reliable way to determine the owning of the code. It is related not only to SyntaxWarnings, but to runtime DeprecationWarnings. Maybe silence warnings only for readonly files and make files installed by PIP readonly?
Identifying the author vs the user seems like a good idea. Relying on the OS filesystem seems like a solution that would cause some challenges. Can we embed that information in the .pyc file instead? That way, Python knows that it is module/package that has been installed with pip or similar and the end user is likely not the author.