Yapf: Integration with pyproject.toml for Formatting style

Created on 16 Apr 2019  路  6Comments  路  Source: google/yapf

PEP 518 defines pyproject.toml as a configuration file for software packages to use to specify their build dependencies.

Particularly, it provides an alternative to setup.cfg.

For example, a section in pyproject.toml could look like:

[tool.yapf]
based_on_style = "pep8"
spaces_before_comment = 4
split_before_logical_operator = true

Initially, yapf could look for a pyproject.toml on the project and determine formatting style settings from that similar to how it does with setup.cfg.

This request would be an additional method to the currently supported methods of specifying yapf settings. Any chance we could see this in yapf?

All 6 comments

Is this going to be implemented?
If yes, what is the process state atm?

Looking forward to this feature.

I don't see an issue with doing this. I don't have any knowledge about pyproject.toml, but I'll look into it. If someone wanted to submit a PR, we would accept it :)

Does yapf support configure .yapfignore in pyproject.toml too?

@dclong No, I implemented only formatting style configuration in the PR above.

@hirosassa Thank you for the info! I've opened an issue https://github.com/google/yapf/issues/904 requesting support yapf ignore configuration in pyproject.toml.

Was this page helpful?
0 / 5 - 0 ratings