HBNetwork / python-decouple

Strict separation of config from code.
MIT License
2.79k stars 192 forks source link

Enforce a search order for settings files #79

Closed jayennis22 closed 4 years ago

jayennis22 commented 5 years ago

Prior to Python 3.7 dictionaries are unordered. This leads to unpredictable results when you define a settings.ini file and you already have a .env file for other purposes (such as pipenv environment variables). Sometimes the settings.ini file will be loaded by decouple and sometimes the .env will be loaded. This change replaces the Python dict with an OrderedDict, which is compatible back to Python 2.7.

This has become the functionality in 3.7, this pull request simply makes it retroactive and removes ambiguity.

Please let me know if you would like to see this done differently, and thanks for creating decouple.