This is an annoying issue related to pkg_resources being deprecated (
https://github.com/Pylons/pyramid/issues/3731); I am wondering if anyone has figured out a solution for it.
The /scripts with registered entrypoints have executables created that look like this:
# -*- coding: utf-8 -*-
import re
import sys
from {{MYAPP}}.scripts.{{SCRIPTNAME}} import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())
When these scripts are executed, the Python interpreter will first import {{MYAPP}}which will import Pyramid, which then imports pkg_resources, which then emits the warning.
I can't figure out a way to suppress this warning during console script execution, aside from disabling it in every context. I am fine with this on the webapp, but this creates noise - and problems - for console scripts that are registered into cron.
Disabling warnings in the script does not work, because the /scripts/{{script}} is imported *after* the topline namespace is imported.
I don't think there is anything I can do here, but wondered if anyone else has figured this out.
The only approach I can think of, is disabling this warning in all contexts by default, then letting me re-enable it via an environment variable and having a unit test do coverage for it. I'd rather not do that, but it may be the only way.