os.getenv
I already saw this pattern a lot with developers from outside the Python system trying to read environment variables, and with the rise of coding agents, it has spread even more.
When a model tries to read an environment variable, almost invariably it will reach for os.getenv.
This is a bad idea.
os.getenv("VAR_NAME") will return None when the environment does not define VAR_NAME.
This almost certainly leads to hard-to-debug errors when the configuration is incorrect.
What should be a simple configuration fix turns into a 30 minute bug hunt.
Instead, use os.environ["VAR_NAME"].
This will crash immediately if VAR_NAME is not defined in the environment.
The only circumstance os.getenv might be appropriate is when a environment variable is optional.
However, in that case I prefer os.environ.get("VAR_NAME"), which does the exact same thing, but with regular dictionary operations.
That way we don't have to keep in mind the special behaviour of os.getenv.