Write a Better config.py

John Raines
7 min readOct 18, 2021

Your app deserves it. The world deserves it.

Photo by Lucas Santos on Unsplash

Congratulations! You’ve decided not to hard-code values like MAX_SIZE at the top of seven different modules. You’re going to make a config.py module to handle such things. But what will it look like? I want to tell you about some alternatives to simply dropping all those uppercase constants into a .py file. Here are the golden nuggets I plan to drop in this article:

--

--

John Raines

For money, I’m a software engineer who primarily works in machine learning platform design. For free, I read fantasy novels and raise children (my own).