PythonのFormatterとLinterとしてRuffを使用する。
bash.sh
pip install ruff ipykernel
.pyproject.toml
[tool.ruff]
extend-include = ["*.ipynb"]
line-length = 88
.vscode/extensions.json
{
"recommendations": [
"charliermarsh.ruff",
"ms-python.python"
],
}
.vscode/settings.json
{
"notebook.formatOnSave.enabled": true,
"notebook.codeActionsOnSave": {
"notebook.source.fixAll": "explicit",
"notebook.source.organizeImports": "explicit"
},
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll": "explicit",
"source.organizeImports": "explicit"
},
}
}