[build-system]
requires = ["flit-core>=3.11"]
build-backend = "flit_core.buildapi"

[project]
name = "pyproject-metadata"
dynamic = ["version"]
description = "PEP 621 metadata parsing"
readme = "README.md"
requires-python = ">=3.8"
license = "MIT"
license-files = ["LICENSE"]
authors = [
    { name = "Filipe Laíns", email = "lains@riseup.net" },
]
classifiers = [
    "Programming Language :: Python :: 3",
    "Programming Language :: Python :: 3 :: Only",
    "Programming Language :: Python :: 3.8",
    "Programming Language :: Python :: 3.9",
    "Programming Language :: Python :: 3.10",
    "Programming Language :: Python :: 3.11",
    "Programming Language :: Python :: 3.12",
    "Programming Language :: Python :: 3.13",
    "Programming Language :: Python :: 3.14",
    "Programming Language :: Python :: 3.15",
]
dependencies = [
    "packaging>=23.2",
]

[project.urls]
changelog = "https://pep621.readthedocs.io/en/stable/changelog.html"
documentation = "https://pep621.readthedocs.io/en/stable/"
homepage = "https://github.com/pypa/pyproject-metadata"

[dependency-groups]
docs = [
    "furo>=2023.9.10",
    "sphinx-autodoc-typehints>=1.10.0",
    "sphinx>=7.0",
    "sphinx-autodoc-typehints",
    "myst-parser",
]
test = [
    "pytest-cov>=4",
    "pytest>=7.4; python_version>='3.12'",
    "pytest>=7; python_version<'3.12'",
    'tomli>=1.1;python_version<"3.11"',
    'exceptiongroup>=1.0;python_version<"3.11"',  # Optional
]
dev = [{include-group = "test"}]


[tool.flit.sdist]
include = ["LICENSE", "tests/**", "docs/**", ".gitignore"]


[tool.pytest.ini_options]
minversion = "7.0"
addopts = ["-ra", "--showlocals", "--strict-markers", "--strict-config"]
xfail_strict = true
filterwarnings = ["error"]
log_level = "INFO"
testpaths = ["tests"]


[tool.mypy]
strict = true
warn_unreachable = false
python_version = "3.10"
enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]
files = ["pyproject_metadata", "tests", "noxfile.py"]


[tool.ruff]
show-fixes = true

[tool.ruff.lint]
select = ["ALL"]
ignore = [
  "S101",    # Asserts are used by mypy and pytest
  "PLR09",   # Design related (too many X)
  "PLR2004", # Magic value in comparison
  "COM812",  # Trailing commas inform the formatter
  "E501",    # Not worried about long lines in strings
  "D200",    # Don't force single line docstring (for now)
  "D205",    # Some of our summaries are more than a line (for now)
]
flake8-builtins.ignorelist = ["copyright", "license"]
pydocstyle.convention = "pep257"

[tool.ruff.lint.per-file-ignores]
"tests/**" = [
  "PTH123",  # Path.open not needed for simple files
  "D",       # Tests don't need docs
  "INP001",  # Tests don't need an __init__
  "FBT001",  # Bools are fine in test fixtures/params
  "SLF001",  # Tests can access private members
  "ERA001",  # TODO: temporary
]
"docs/**" = [
  "INP001",  # Docs don't need an __init__
  "ERA001",  # Commented out code in conf.py
  "D",
]
"noxfile.py" = ["D"]

[tool.ruff.format]
docstring-code-format = true

[tool.coverage]
run.branch = true
run.source_pkgs = ["pyproject_metadata"]
html.show_contexts = true
report.show_missing = true
report.exclude_also = [
    "if typing.TYPE_CHECKING:",
]

[tool.uv]
exclude-newer = "7 days"

[tool.repo-review]
ignore = ["PC140"]
