Skip to content

Instantly share code, notes, and snippets.

@absurd
Created March 11, 2018 23:23
Show Gist options
  • Save absurd/04a57c863b4df18e6b557b51d8ad6bc7 to your computer and use it in GitHub Desktop.
Save absurd/04a57c863b4df18e6b557b51d8ad6bc7 to your computer and use it in GitHub Desktop.
bin/pylint virtualenv load plugins kludge v1
#!/Users/you/.virtualenvs/yourproject/bin/python3.6
# -*- coding: utf-8 -*-
import re
import sys
from pip.operations.freeze import freeze
from pylint import run_pylint
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
if any(['pylint-django' in x for x in freeze()]):
sys.argv += ['--load-plugins', 'pylint_django']
sys.exit(run_pylint())
# cute but quickly supplanted by virtualenvwraper postmkvirtualenv hook
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment