Adding support for `wsgi_scripts` entrypoint?

If I’m not mistaken, that wouldn’t do much for you. That would generate a script wrapped in if __name__ == '__main__': which wouldn’t work with any WSGI server, e.g. we’ll get something like the following in the scripts path (seen by sysconfig.get_path("scripts")):

#!/tmp/venv/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from foo.wsgi import init_application
if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
    sys.exit(init_application())

When what we actually want is the following, again in the scripts path:

#!/tmp/venv/bin/python
# -*- coding: utf-8 -*-
from foo.wsgi import init_application
init_application()

(assuming you strip away all of the debug stuff, which really isn’t relevant)

Okay, that’s probably my answer. Given how important WSGI is the Python ecosystem I figured this would be analogous to the console_scripts entrypoint and broadly applicable. If that’s not the case though so be it.

Thanks for the feedback!

1 Like