Example

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"]

For Python < 3.11 you need the Python package toml to convert TOML files into Python dictionaries.

For Python ≥ 3.11 you can load TOML files, for example with:

[1]:
import tomllib


with open("pyproject.toml", "rb") as f:
    data = tomllib.load(f)

data
[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']}}}