I want to have a .ini
entry that references special variables
e.g.
[magic_module]
magic_directory: ${env:PWD}/magic
currently, I have the non-portable
[magic_module]
magic_directory: C:/Users/user1/projects/project1/magic
I would like to have a .ini
path entry that is more portable instead of hard-coded to my computer. Does the Python ConfigParser
natively perform substitutions like this?
This is slightly different than SO question ConfigParser and String interpolation with env variable because I am wondering about any possible default interpolated variables, not just environment variables.
This is for passing information to a different module (mypy
) that uses ConfigParser
.
Specifically, this is for improving portability in a Python package. I'm trying to set the mypy_path
within a mypy.ini
while working with a pipenv-created virtualenv python environment. The user install module paths will change so I want to portably set that for mypy
.
Using Python 3.7.