Actually, there is a way to make it compatible. For my ideas library, which uses import hooks to modify Python’s syntax, when a transformation is specified explicitly on the command line, the source module foo will be executed with the proper naming convention.
Code of foo.py:
print(f"{__name__=}")
Execution with a sample transformation (enabling to write function as equivalent to def)
(venv) C:\Users\Andre\tmp
> py -m ideas -a function_keyword foo
__name__='__main__'
As you can see, foo’s name is like one would want for the main Python source.
However, I just noticed that I forgot to do the same when no transformation is specified on the command line.
(venv) C:\Users\Andre\tmp
> py -m ideas foo
__name__='foo'
I should fix this …