Ty 和 Ruff 都是使用 Rust 语言开发的高性能 Python 开发工具,它们分工不同,可以完美配合,提升开发体验。
之前的文章介绍了 Python Development in Emacs ,其中是使用 Pyright 作为 LSP 服务端,如果使用 Ty+Ruff 作为服务端,则项目配置需要做一些调整。
在 pyproject.toml 中增加配置:
[tool.ty.environment]
python = ".venv"
[tool.ruff]
line-length = 88
在 .dir-locals.el 中增加配置:
((python-base-mode . ((python-indent-offset . 4)
(python-indent-guess-indent-offset-verbose . nil)
(python-shell-interpreter . "python")
(python-shell-virtualenv-root . "/project/.venv/")
(eglot-server-programs . (((python-mode python-ts-mode) . ("rass" "python"))))
(apheleia-formatter . (ruff)))))
Related
Python Development in Emacs
A guide to setup python development environment in Emacs.
Eglot: Connect to Multiple LSP Servers
Use rassumfrassum to connect a LSP client to multiple LSP servers.
Integrate Harper With Emacs
Harper is a grammar checker designed to run anywhere there is text (so really, anywhere).