Firewall setup for Python.app incoming connection
Create a self-signed certificate.


Open Keychain Access. Applications > Utilities > Keychain Access.
Keychain Access menu > Certificate Assistant > Create a Certificate...
Enter a name like "My Certificate".
Select Identity Type: Self Signed Root
Select Certificate Type: Code Signing
Check the Let me override defaults box
Click Continue
Enter a unique Serial Number
Enter 7300 for the Validity Period.
Click Continue
Click Continue for the rest of the dialogs


Now sign your application

codesign -s "My Certificate" -f $(which python)


In the dialog that appears, click "Allow".

With the OS X firewall enabled, you can remove the "Do you want the application "python" to accept incoming network connections?" message.