-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mypy.ini processing should allow variable expansion ("interpolation") #6476
Comments
I thought this could easily be solved by
given
that solution worked in toy program
I tried out that solution within
Darn. Looking closer at the code, the change may not be so trivial. Relates to commit 2fbb724. |
For context, do other development tools with config files (e.g., linters) usually support interpolating environment variables? That could help decide whether this is something worth supporting in mypy. |
@JelleZijlstra this Issue might be broken out into two questions:
Regarding the |
This would be a really helpful feature for situations like pipenv where I need to have a wrapper script to make sure mypy knows where to look for packages to avoid import errors and to ensure that the config is portable for the rest of my team. |
This is now supported (in most cases), see https://mypy.readthedocs.io/en/latest/config_file.html:
|
Any hint as to what flags those are? |
tl;dr I cannot write variable-expanded directory paths within
mypy.ini
to set themypy_path
. I cannot commit a usefulmypy.ini
. It would be cool if mypy supported variable expansion ("interpolation") within it'sconfigparser
processed file.Problem example
Given my pipenv-created virtualenv at
C:/Users/user1/.virtualenvs/project1-rAPKj25Z
, I want to setmypy_path
to the virtual environment'sLib/site-packages
. I can setbut that is not portable (i.e. committable). I would like to write something portable like
where
VIRTUAL_ENV
is set bypipenv
within the caller's environment (or perhaps apython-dotenv
file)....
This is a feature request. I am not sure if this is outside the expectations for
mypy.ini
files. However, it seems like a clean way to have more portablemypy.ini
files.Using
The text was updated successfully, but these errors were encountered: