Skip to content

Prefer YAPF over autopep8 #135

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

masad-frost
Copy link
Contributor

YAPF is a real formatter where-as autopep8 is more of a lint fixer. See the YAPF readme https://github.com/google/yapf, see also discussion here palantir/python-language-server#328

The other reason is that I will be improving YAPF support, starting with adding support for protocol's formatting options (see #134) and then following up with sending actual text edits using yapf unidiff output format instead of the whole document https://github.com/python-lsp/python-lsp-server/blob/develop/pylsp/plugins/yapf_format.py#L49-L58

Copy link
Member

@ccordoba12 ccordoba12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @masad-frost, thanks for your contribution! You said:

YAPF is a real formatter where-as autopep8 is more of a lint fixer

That's open to debate, but we consider Autopep8 provides simpler formatting than Yapf (or Black, for that matter). So, we don't plan to change the default formatter here, sorry.

However, please note that these are only default options and they can be very easily changed from your editor or IDE by disabling the Autopep8 plugin and activating the Yapf one. Basically, each plugin can be enabled/disabled by sending the appropriate request from the client.

@masad-frost
Copy link
Contributor Author

It's all good. Thank you!

@masad-frost masad-frost closed this Dec 9, 2021
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