microsoft / vscode-python

Python extension for Visual Studio Code
https://aka.ms/pvsc-marketplace
MIT License
4.28k stars 1.17k forks source link

Multiple envfiles from launch.json #23883

Open andrewFirstResonance opened 1 month ago

andrewFirstResonance commented 1 month ago

Hey all, I know this was a GitHub issue that was decided that there wasn't enough community support for a few years ago, but I do think this still would be a really nice feature to have. It's very common to have one env file git committed to a repo with either template values or safe generic values, and then another private env file that basically upserts over the existing env file with your own private values that are not git-committed. It's a nice workflow.

I've also seen flows like .env.base, .env.local. .env.production, etc. where .env.production is .env.base sourced and then .env.production sourced over it.

Hope that all made sense. Anyways, would love to see y'all reconsider development on this issue. Thanks! https://github.com/microsoft/vscode-python/issues/10142

andrewFirstResonance commented 1 month ago

I guess a solution could be to use python-dotenv to source env variables within your python code. I've also tried building a preLaunchTask that just sources my env files with a bash command, but I think the task runs in a different shell than my integratedTerminal.