Beispiel

pyproject.toml

[tool.black]
line-length = 79

[tool.isort]
atomic=true
force_grid_wrap=0
include_trailing_comma=true
lines_after_imports=2
lines_between_types=1
multi_line_output=3
not_skip="__init__.py"
use_parentheses=true

known_first_party=["MY_FIRST_MODULE", "MY_SECOND_MODULE"]
known_third_party=["mpi4py", "numpy", "requests"]

Für Python < 3.11 benötigt ihr das Python-Paket toml, um TOML-Dateien in Python-Dictionaries umwandeln zu können. Anschließend könnt ihr TOML-Dateien laden, z.B. mit:

[1]:
import toml


config = toml.load("pyproject.toml")

config
[1]:
{'tool': {'black': {'line-length': 79},
  'isort': {'atomic': True,
   'force_grid_wrap': 0,
   'include_trailing_comma': True,
   'lines_after_imports': 2,
   'lines_between_types': 1,
   'multi_line_output': 3,
   'not_skip': '__init__.py',
   'use_parentheses': True,
   'known_first_party': ['MY_FIRST_MODULE', 'MY_SECOND_MODULE'],
   'known_third_party': ['mpi4py', 'numpy', 'requests']}}}