I was having the same issue.
Basically I followed the instructions here: https://leancrew.com/all-this/2014/01/stopping-the-python-rocketship-icon/
and that fixed it!
Here's a quick guide:
On the terminal, navigate to where the python installation files are: In my case, I installed python via homebrew. So the path to the Info.plist file is: /opt/homebrew/Frameworks/Python.framework/Versions/3.9/Resources/Python.app/Contents . On the link provided, it is using the Python that is backed in macOs. But I use this version for development.
We need to modify the Info.plist file. But first, chmod it: sudo chmod 666 Info.plist
I just used vscode to edit the file. In the post I provided, it is using a software to convert the file. But in my case I didn't need it.
Add the following lines just before the final </dict> near the end of the file:
<key>LSUIElement</key>
<true/>
Not needed, but you can change the permissions back to what they were: sudo chmod 644 Info.plist
Done! re-execute your app and no more python process on the dock.