Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <campbell@blender.org>2022-04-19 08:50:35 +0300
committerCampbell Barton <campbell@blender.org>2022-04-22 03:13:39 +0300
commit30acc5f9cde7e94713600b8481837bda996f9753 (patch)
treead8224aa2598afabc76b504de1229299c9ba6886 /pyproject.toml
parent2547c3c70ceef763ae9698b8dc76c12168a605d4 (diff)
pyproject: add configuration for autopep8
This adds pyproject.toml, needed to configure defaults for autopep8. The file is auto-discovered in a similar way to .clang-format, other tools could be configured here too. For now just configure autopep8 so this can be enabled in IDE's without causing unexpected edits such as wrapping lines over 80 columns in width. Now autopep8 can be used from the root directory by running: autopep8 . This uses multiple-jobs to run autopep8 over all Python scripts except paths that are explicitly ignored in exclude defined by pyproject.toml. Reviewed By: mont29, brecht, sybren Ref D14686
Diffstat (limited to 'pyproject.toml')
-rw-r--r--pyproject.toml50
1 files changed, 50 insertions, 0 deletions
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 00000000000..921157d9034
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,50 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+[tool.autopep8]
+# Configuratuion for `autopep8`, allowing the command: autopep8 .
+# to reformat all source files.
+#
+# NOTE: the settings defined here map directly to commmand line arguments
+# which will override these settings when passed in to autopep8.
+
+max_line_length = 120
+
+ignore = [
+ # Info: Use `isinstance()` instead of comparing types directly.
+ # Why disable? Changes code logic, in rare cases we want to compare exact types.
+ "E721",
+ # Info: Fix bare except.
+ # Why disable? Disruptive, leave our exceptions alone.
+ "E722",
+ # Info: Fix module level import not at top of file.
+ # Why disable? Re-ordering imports is disruptive and breaks some scripts
+ # that need to check if a module has already been loaded in the case of reloading.
+ "E402",
+ # Info: Fix various deprecated code (via lib2to3)
+ # Why disable? Does nothing besides incorrectly adding a duplicate import,
+ # could be reported as a bug except this is likely to be removed soon, see:
+ # https://github.com/python/cpython/issues/84540.
+ "W690",
+]
+
+# Exclude:
+# - `./extern/` because it's maintained separately.
+# - `./release/scripts/addons*` & `./source/tools/` because they are external repositories
+# which can contain their own configuration and be handled separately.
+# - `./release/scripts/modules/rna_manual_reference.py` because it's a generated data-file.
+exclude = """
+./extern/*,
+./release/scripts/addons/*,
+./release/scripts/addons_contrib/*,
+./release/scripts/modules/rna_manual_reference.py,
+./source/tools/*,
+"""
+
+# Match CPU count.
+jobs = 0
+
+# Format files in-place.
+in_place = true
+
+# Format directories recursively (except for excluded paths).
+recursive = true