Search code examples
pythonsublimetextsublimetext3pylint

Is this possible > Sublime3 + a python linter + virtualenv?


I've read a lot of conflicting SO posts, gone through all the relevant github issues I could find, and tried a myriad of config options in various sublime config files before finally giving up and resorting to this plea for help.

It's as the title states - I'd like to use sublime3 + sublime linter + something like pylint to lint my Python code using the Python installed in the specific project virtual environment. I'm not sure of the exact toolchain but as long as it works that's good enough for me.

Please, does anyone know if it's possible - and more importantly how to actually do it?

Thanks in advance,


Solution

  • Check out SublimePythonIDE (available on Package Control). I believe it uses Pyflakes to lint your code by default.

    The documentation also shows you how to set it to use the interpreter in a virtual environment. I don't think it will actively lint your code with virtual environment, but you will have access to stuff like autocomplete, jump-to-definition, view documentation, etc.

    In your project settings:

    {
        "folders": [
            {
               "path": "XYZ"
            },
            {
                "path": "ABC"
            }
        ],
        "settings": {
            "python_interpreter": "/path/to/some/virtualenv/bin/python"
        }
    }