Skip to content

Instantly share code, notes, and snippets.

@eayoungs
Forked from FMCorz/setup.md
Created December 21, 2017 22:45
Show Gist options
  • Save eayoungs/c577d8c3f011c2b09047877d112df74c to your computer and use it in GitHub Desktop.
Save eayoungs/c577d8c3f011c2b09047877d112df74c to your computer and use it in GitHub Desktop.
Sublime Text, Django and Pylint

Pre-requisites

  • Install SublimeLinter
  • Install SublineLinter-pylint

Global pylint

Install pylint globally.

pip install pylint

Check that pylint is in your PATH.

echo $PATH
which pylint

You may need to extend your PATH to contain the .local/bin folder.

vi ~/.profile

# Set PATH so it includes user's private local bin if it exists.
if [ -d "$HOME/.local/bin" ] ; then
    PATH="$HOME/.local/bin:$PATH"
fi

Virtualenv

In your project's virtualenv, install pylint-django.

pip install pylint-django

Sublime project

From the menu Project > Edit project, adapt the path to Python, and add the django plugin.

{
	"folders":
	[
		{
			"path": "..."
		}
	],
	"SublimeLinter":
	{
		"@python": "/path/to/virtualenv/bin/python",
		"linters": {
			"pylint": {
				"args": ["--load-plugins=pylint_django"]
			}
		}
	}
}

.pylintrc

Create a .pylintrc file at the root of your project for fine tuning.

See also

Pylint documentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment