Skip to content

Feat/lsp opt dep and emacs config#55

Closed
namcsi wants to merge 2 commits intopotassco:masterfrom
namcsi:feat/lsp-opt-dep-and-emacs-config
Closed

Feat/lsp opt dep and emacs config#55
namcsi wants to merge 2 commits intopotassco:masterfrom
namcsi:feat/lsp-opt-dep-and-emacs-config

Conversation

@namcsi
Copy link
Contributor

@namcsi namcsi commented Feb 23, 2026

This PR adds a lsp optional dependency (that is also included in the dev optional dependency) which installs the python-lsp-sever along with the extra plugings for the tools used by the project template.

This will allow users of the template to simply run nox -s dev and and activate their nox dev virtual environment (perhaps via direnv) to have a full python LSP available for them in their PATH for their editor to talk to.

I also added a .dir-locals.el to configure the python-lsp-server and it's plugins for the emacs eglot LSP client by default.

Uses the default configuration, with some small tweaks.
The lsp dependency installs the python-lsp-server via pip, as well as
some useful extensions. Adding this dep. to the dev opt. dep. now
installs a working lsp in the dev nox environment.
@rkaminsk
Copy link
Member

@namcsi, I would like not to add editor specific configs to the template. Everyone uses a different one. For example, my editor does not use any of these lsp's but uses pyright out of the box. I am also not a fan of a zoo of separate configs. This just confuses users starting with the template.

These days, a lot of tools can be configured directly in pyproject.toml. So I would actually suggest to ditch all those separate configs and consolidate in pyproject.toml. On another note, I recently ditched all linters in my python projects in favor of ruff, which supports black-like formatting/import sorting/linting. So my suggestion would be to rather simplify the config to just use ruff+mypy. If you use a ruff and mypy based lsps, you should hopefully get the configuration from the pyproject.toml file out of the box. This should cover the important bits for configuration.

Modern editors should just provide working auto-completion out of the box.

@namcsi
Copy link
Contributor Author

namcsi commented Feb 24, 2026

Fair enough, if we want to keep the project template LSP agnostic then this addition is not helpful.

The LSP client config (found in the commited .dir-locals for emacs) cannot be consolidated into pyproject.toml since it is specific to the editor and is not tied to the python ecosystem - but as you said, this can be left to the user of the template. The idea was more so to have some sane defaults for an emacs LSP user already included for ease of use - but this of course requires some default LSP to be assumed, which you would rather avoid.

As to ruff, I have been meaning to use it since I have read nice things, and I agree it would help consolidate the various linting tools we have, so I would love that personally.

@namcsi namcsi closed this Feb 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants