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

Update, now sublime linter recommends updating per project settings as follows:

"settings":
{
    "SublimeLinter.linters.flake8.python": "/path/to/venv/bin/python"
}

There is an option to plug flake8 to SublimeLinter with custom virtualenv on per project basis in Sublime Text 3.

You should install flake8 to your virtualenv using pip install flake8, but be careful no to include flake8 and its dependencies in your requirements.txt.

Then you should edit your SublimeText project settings file and paste the SublimeLinter section there with full path to the Python binary for your particular project's virtualenv:

{
    "settings": {
        "SublimeLinter": {
            "linters": {
                "flake8": {
                    "python": "/path/to/virtualenv_folder/bin/python"
                },
            }
        }
    }
}

Or you may use the one shortened property SublimeLinter.linters.flake8.python as it's been mentioned in the other answer.

So every time SublimeLinter executes in each *.py file being opened from the project, flake8 will be executed from that custom Python virtualenv binary.


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"
    }
}