I tend to develop my apps in 'setup.py develop' -mode. I'd want the configuration to switch automagically on production mode when the program gets 'setup.py install'ed.
This can be done by poor hacks, like checking whether installation directory contains 'setup.py', but I wonder whether pkg_resources can do this for me somehow.
Indeed, pkg_resources
will do that:
dist = pkg_resources.get_distribution('your-app')
if dist.precedence == pkg_resources.DEVELOP_DIST:
# package is in development mode
...