Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Pylint for remote projects
#!/usr/bin/env python3
import subprocess
import sys
path = sys.argv[-1]
if path.startswith('/path/to/my/local/source/folder/'):
path = path.replace('/path/to/my/local/source/folder/', '/app/folder/')
subprocess.run(['docker-compose', 'exec', '-T', 'cross', 'sh', '-c',
"PYTHONPATH=/app/folder/extrasrc pylint {} {}".format(" ".join(sys.argv[1:-1]), path)],
stdout=sys.stdout)
else:
subprocess.run(['/home/igor/.local/bin/pylint'] + sys.argv[1:])
import io
import sys
import traceback
import subprocess
_input = io.open(sys.stdin.fileno(), encoding='utf-8')
while True:
try:
data = _input.readline().strip()
if not data:
continue
proc = subprocess.Popen(
['docker-compose', 'run', '--rm', '--entrypoint=python', 'cross', 'jd/completion.py', 'release'],
stdout=sys.stdout,
stdin=subprocess.PIPE,
cwd='/path/to/my/local/source/'
)
proc.communicate(input=(data + '\n').encode('utf-8'))
except Exception:
sys.stderr.write(traceback.format_exc() + '\n')
sys.stderr.flush()
sys.exit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.