[PATCH] D143852: [docs] Add Python coding standard to documentation

Tobias Hieta via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 12 05:58:52 PDT 2023


thieta updated this revision to Diff 521624.
thieta added a comment.

Hi! After that nudge at EuroLLVM, I picked this one up and hopefully addressed your comments!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143852/new/

https://reviews.llvm.org/D143852

Files:
  llvm/docs/CodingStandards.rst


Index: llvm/docs/CodingStandards.rst
===================================================================
--- llvm/docs/CodingStandards.rst
+++ llvm/docs/CodingStandards.rst
@@ -50,6 +50,9 @@
 conforming, modern, and portable C++ code as the implementation language of
 choice.
 
+For automation, build-systems and utility scripts Python is preferred and
+is widely used in the LLVM repository already.
+
 C++ Standard Versions
 ---------------------
 
@@ -102,6 +105,21 @@
 please consult `that section of the programmer's manual
 <https://llvm.org/docs/ProgrammersManual.html#picking-the-right-data-structure-for-a-task>`_.
 
+Python version and Source Code Formatting
+-----------------------------------------
+
+The current minimum version of Python required is documented in the :doc:`GettingStarted`
+section. Python code in the LLVM repository should only use language features
+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 unecessary churn in the formatting rules
+we currently use black version 23.x in LLVM.
+
 Mechanical Source Issues
 ========================
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D143852.521624.patch
Type: text/x-patch
Size: 1437 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230512/fbd7ce06/attachment.bin>


More information about the llvm-commits mailing list