You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.rst
+33Lines changed: 33 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -78,6 +78,19 @@ Configuration
78
78
- ``normal``, ``silent``, ``skip`` or ``error``
79
79
- ``mypy`` **parameter** ``follow-imports``. In ``mypy`` this is ``normal`` by default. We set it ``silent``, to sort out unwanted results. This can cause cache invalidation if you also run ``mypy`` in other ways. Setting this to ``normal`` avoids this at the cost of a small performance penalty.
80
80
- ``silent``
81
+
* - ``mypy_command``
82
+
- ``pylsp.plugins.pylsp_mypy.mypy_command``
83
+
- ``array`` of ``string`` items
84
+
- **The command to run mypy**. This is useful if you want to run mypy in a specific virtual environment. Requires env variable ``PYLSP_MYPY_ALLOW_DANGEROUS_CODE_EXECUTION`` to be set.
85
+
- ``[]``
86
+
* - ``dmypy_command``
87
+
- ``pylsp.plugins.pylsp_mypy.dmypy_command``
88
+
- ``array`` of ``string`` items
89
+
- **The command to run dmypy**. This is useful if you want to run dmypy in a specific virtual environment. Requires env variable ``PYLSP_MYPY_ALLOW_DANGEROUS_CODE_EXECUTION`` to be set.
90
+
- ``[]``
91
+
92
+
Both ``mypy_command`` and ``dmypy_command`` could be used by a malicious repo to execute arbitrary code by looking at its source with this plugin active.
93
+
Still users want this feature. For security reasons this is disabled by default. If you really want it and accept the risks set the environment variable ``PYLSP_MYPY_ALLOW_DANGEROUS_CODE_EXECUTION`` in order to activate it.
81
94
82
95
Using a ``pyproject.toml`` for configuration, which is in fact the preferred way, your configuration could look like this:
83
96
@@ -151,6 +164,26 @@ With ``report_progress`` your config could look like this:
151
164
"report_progress": True
152
165
}
153
166
167
+
With ``mypy_command`` your config could look like this:
168
+
169
+
::
170
+
171
+
{
172
+
"enabled": True,
173
+
"mypy_command": ["poetry", "run", "mypy"]
174
+
}
175
+
176
+
With ``dmypy_command`` your config could look like this:
0 commit comments