[llvm] [docs] Add more details about Python formatting (PR #66141)

via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 12 23:07:57 PDT 2023


================
@@ -115,10 +115,19 @@ available in this version of Python.
 The Python code within the LLVM repository should adhere to the formatting guidelines
 outlined in `PEP-8 <https://peps.python.org/pep-0008/>`_.
 
-For consistency and to limit churn, code should be automatically formatted with the
-`black <https://github.com/psf/black>`_ utility. Black allows changing the formatting
-rules based on major version. In order to avoid unnecessary churn in the formatting rules
-we currently use black version 23.x in LLVM.
+For consistency and to limit churn, code should be automatically formatted with
+the `black <https://github.com/psf/black>`_ utility with its default rules
+(e.g., avoid specifying ``--line-length`` even though it does not default to
+80). The default rules can change between major versions of black. In order to
+avoid unnecessary churn in the formatting rules we currently use black version
+23.x in LLVM.
+
+When contributing a patch unrelated to formatting, use the `darker
+<https://pypi.org/project/darker/>`_ utility with its default rules to format
+any changed Python code. Doing so should ensure the patch will pass the Python
----------------
cor3ntin wrote:

I do not have a specific suggestion, but could we make it clearer that `darker` is something that calls `black` rather than a different formatter?

https://github.com/llvm/llvm-project/pull/66141


More information about the llvm-commits mailing list