The pyproject.toml
file in this template is a configuration file that specifies build system requirements and settings for various development tools. Here's a breakdown of its contents:
[build-system]
requires = ["setuptools>=45", "wheel"]
build-backend = "setuptools.build_meta"
This section specifies that the project uses setuptools
(version 45 or higher) and wheel
for building the package, and sets setuptools.build_meta
as the build backend.
[tool.black]
line-length = 88
target-version = ['py38']
include = '\.pyi?$'
extend-exclude = '''
/(
# directories
\.eggs
| \.git
| build
| dist
)/
'''
This configures the Black code formatter:
- Sets the maximum line length to 88 characters
- Targets Python 3.8 syntax
- Includes all
.py
and.pyi
files - Excludes certain directories from formatting
[tool.isort]
profile = "black"
multi_line_output = 3
include_trailing_comma = true
force_grid_wrap = 0
use_parentheses = true
ensure_newline_before_comments = true
line_length = 88
This configures the isort import sorter:
- Uses the "black" profile for compatibility with Black
- Sets various formatting options for imports
- Matches the line length with Black's configuration
[tool.pylint.master]
ignore-patterns = "test_.*?py"
[tool.pylint.messages_control]
disable = "C0330, C0326"
[tool.pylint.format]
max-line-length = "88"
This configures the Pylint linter:
- Ignores test files in linting
- Disables certain warning codes (C0330 and C0326) which conflict with Black
- Sets the maximum line length to match Black's configuration
By using this pyproject.toml
file, we ensure consistent formatting and linting across the project, which helps maintain code quality and readability.