安装
pip install flake8
pip install yapf
配置vscode
打开settings.json文件
"python.linting.flake8Enabled": true,
"python.formatting.provider": "yapf",
"python.linting.flake8Args": ["--max-line-length=248"],
"python.linting.pylintEnabled": false
lauch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{ "python": "/home/jovyan/.conda/envs/torch1.7/bin/python",
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
}
]
}
setting.json
{
"jupyter.jupyterServerType": "local",
"python.linting.flake8Enabled": true,
"terminal.integrated.fontFamily": "monospace",
"terminal.integrated.fontSize": 16,
"python.envFile": "${workspaceFolder}/.vscode/.env",
"python.linting.flake8Args": [
"--max-line-length=1024"
],
"python.formatting.provider": "yapf"
}
.env
PYTHONPATH=./:${PYTHONPATH}
Python Docstring Generator