There're two parts to this issue:
Parsing
We should probably always follow dotenv syntax:
Substitution
There are currently two ways of substituting variables in a .env file:
and
and a combination of both has to used to resolve all variables in different situations. However, this is not standard syntax. Again we should probably rely on the dotenv syntax always.
There're two parts to this issue:
Parsing
We should probably always follow dotenv syntax:
Circuit Python: https://docs.circuitpython.org/en/latest/shared-bindings/dotenv/index.html#
It's almost very similar to what we do; except for the multiline support and comments on the same line, so good news is it won't break us if we decide to align.
Python dot-env: https://pypi.org/project/python-dotenv/
Match with how it does variable substitution: Standardize how to do environment variable parsing & substitution #18307
Substitution
There are currently two ways of substituting variables in a
.envfile:and
and a combination of both has to used to resolve all variables in different situations. However, this is not standard syntax. Again we should probably rely on the dotenv syntax always.
${env:...}only works for process env variables (for eg.PATH) when debugging or when resolving env variables in settings.${env:...}in.envfiles when debugging a Python file: Environment variable definitions file substitution does not work when debugging a Python file vscode-python-debugger#159. Make sure Environment variable definitions file substitution does not work when debugging a Python file vscode-python-debugger#159 is taken care of with this issue.${env:...}. It works only with${...}. Need to correct the docs: Test envVarsService newline substitution behavior #17747 (review)..envfile is currently not supported when running code in terminal: Use environment variables defined in.envfile when running code in a terminal #944${...}can not be used for process env variables when debugging: https://github.com/microsoft/debugpy/issues/821. Solution:vscode-python/src/client/common/variables/environmentVariablesProvider.ts
Line 56 in 456ac06
${...}in addition to${env:...}.