It doesn't have to. But if it does not end in .py, you have to add the --script (or -s for short) flag to tell it to interpret the file as a python script.
Oh, they added that? Very nice, I'll update my instructions and scripts, thanks!
Otherwise uv doesn't recognize it and goes into an infinite loop.