Open Euphorbium opened 5 years ago
I also agree this is an important feature as a typical user of Mypy is a professional developer who also uses Docker/Vagrant for development environment. It would be nice if it would be at least possible to use Mypy executable from environment that is different than the project environment.
There is also the same problem for the Pylint plugin: https://github.com/leinardi/pylint-pycharm/issues/36
This issue has been automatically marked as stale because it has not had activity in the last 60 days.
+1. our team would love to see this issue re-opened and worked on. we are dying to use this plugin, but the lack of support for dockerized virtualenvs is an absolute deal-breaker.
except for this one defect, we would be using your plugin instead of the dropbox plugin, which we think is strictly worse, but which can be configured to be compatible with our dockerized virutalenvs. so we're using the other plugin, even though we like it a LOT LESS than yours!
do maintainers have any plans to pick this up? would you accept contributions to help move it forward?
I got this working by making a little naïve wrapper script that invokes any command in a container for me (based on the name of the calling command).
Given the following script named .execute-in-docker.sh
:
#!/bin/bash
: ${DEV_CONTAINER:=code_1}
SCRIPT_NAME=$(basename $0)
# Certain commands from IntelliJ issues absolute paths from the
# local filesystem, but the container has the root of the source
# tree set as the working directory. So just remove all the local
# paths and it'll all work out
PROJECT_ROOT_DIRECTORY="$(git rev-parse --show-toplevel)/"
function relativize() {
echo $@ | sed "s#${PROJECT_ROOT_DIRECTORY}##"
}
function relativize-all-the-arguments() {
local args=""
for i in $@; do
i=$(relativize "$i")
args="${args} ${i}"
done
echo ${args}
}
exec /usr/local/bin/docker exec ${DEV_CONTAINER} \
/usr/bin/env ${SCRIPT_NAME} $(relativize-all-the-arguments $@)
Then I went ahead and created symlinks for all the commands I want to run in my container:
$ cd bin
$ ln -s .execute-in-docker.sh mypy
$ ln -s .execute-in-docker.sh isort
$ cd ../
$ bin/mypy src/my_funky_tool.py
src/my_funky_tool.py:38:5: error: No return value expected
src/my_funky_tool.py:40:1: error: Argument 1 to "hello" has incompatible type "int"; expected "str"
$ bin/isort src/my_funky_tool.py
In case it helps someone else that is looking to make this plugin work with Docker :)
This issue has been automatically marked as stale because it has not had activity in the last 60 days.
@leinardi Thank you very much for this plugin, it is super helpful Perhaps it is possible to add interpreter settings to the plugin settings? This would solve the problem of running in a docker, since I want PyCharm to use the remote interpreter but the plugin to use the local interpreter I'd be happy to submit a PR if you can give me some guidance
This issue has been automatically marked as stale because it has not had activity in the last 60 days.
Any progress here? Kinda frustrating :/
Step 1: Are you in the right place?
Step 2: Describe your environment
?
?
Step 3: Describe the problem:
Steps to reproduce:
Expected Results:
it should be possible to use mypy within docker.