[project]
name = "mf2dom"
version = "0.1.9"
description = "Microformats2 (mf2) parser and renderer powered by JustHTML."
authors = [
    { name = "Beto Dealmeida", email = "contact@robida.net" },
]
readme = "README.md"
requires-python = ">=3.11"
dependencies = [
  "justhtml>=0.12.0",
]

[dependency-groups]
dev = [
  "pytest>=7",
  "coverage>=7",
  "pre-commit>=3",
  "ruff>=0.5",
  "pytest-cov>=7.0.0",
  "ty>=0.0.1a7",
  "hatch>=1.16.2",
]

[tool.uv.sources]
justhtml = { path = "../justhtml", editable = true }

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.build.targets.wheel]
packages = ["src/mf2dom"]

[tool.pytest.ini_options]
addopts = ["-q"]
testpaths = ["tests"]

[tool.coverage.run]
branch = true
source = ["src/mf2dom"]

[tool.coverage.report]
fail_under = 100
exclude_lines = [
  "pragma: no cover",
  "if TYPE_CHECKING:",
  "raise NotImplementedError",
  "if __name__ == .__main__.:",
]

[tool.ruff]
target-version = "py311"
line-length = 100

[tool.ruff.lint]
select = ["ALL"]
ignore = [
  "D",      # docstring style: project-level choice
  "ANN",    # type hints: we use them where helpful, not everywhere
  "C901",   # complexity checks are too strict for parsing code
  "COM812", # formatter conflict
  "ISC001", # formatter conflict
  "PLR0911", # too many return statements
  "PLR0912", # too many branches
  "PLR0915", # too many statements
  "PLR2004", # magic-value comparisons
  "TD",     # todos
  "FIX",    # todos
  "T201",   # print
  "S101",   # asserts in tests
  "TC001",  # allow runtime type imports
  "TC006",  # allow cast(Type, ...) instead of cast("Type", ...)
]

[tool.ruff.lint.per-file-ignores]
"tests/**/*.py" = ["PLR2004"]
