Skip to content

Latest commit

 

History

History
75 lines (59 loc) · 1.87 KB

PROJECT_TOML.md

File metadata and controls

75 lines (59 loc) · 1.87 KB

Understanding the pyproject.toml File

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 Configuration

[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.

Black Configuration

[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

isort Configuration

[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

Pylint 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.