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

[project]
name = "chango"
dynamic = ["version"]
description = 'CHANgelog GOvernor for Your Project'
readme = "README.rst"
requires-python = ">=3.12"
license = "MIT"
keywords = ["releasenotes", "changelog", "development", "versioning"]
authors = [
  { name = "Hinrich Mahler", email = "chango@mahlerhome.de" },
]
classifiers = [
  "Development Status :: 4 - Beta",
  "Programming Language :: Python",
  "Programming Language :: Python :: 3.12",
  "Programming Language :: Python :: 3.13",
  "Intended Audience :: Developers",
  "Operating System :: OS Independent",
  "License :: OSI Approved :: MIT License",
  "Topic :: Software Development :: Documentation",
  "Topic :: Software Development :: Libraries :: Python Modules",
  "Framework :: Sphinx :: Extension",
]
dependencies = [
  "pydantic-settings~=2.3",
  "shortuuid~=1.0",
  "sphinx>=8.1,<10.0",
  "tomlkit~=0.13",
  "typer~=0.12",
]

[dependency-groups]
docs = [
  "furo>=2024.8,<2026.0",
  "jinja2~=3.1",
  "sphinx>=8.1,<10.0",
  "sphinx-click~=6.0",
  "sphinx-copybutton~=0.5",
  "sphinx-paramlinks~=0.6",
]
tests = [
  "build",
  "pre-commit",
  "pytest>=8.3,<10.0",
  "pytest-cov",
  "pytest-randomly",
]
all = ["pre-commit", { include-group = "docs" }, { include-group = "tests" }]

[project.urls]
Documentation = "https://chango.readthedocs.io/"
Issues = "https://github.com/Bibo-Joshi/chango/issues"
Source = "https://github.com/Bibo-Joshi/chango"

# CLI
[project.scripts]
chango = "chango._cli:app"

# HATCH:
[tool.hatch.version]
path = "src/chango/__about__.py"

# See also https://github.com/pypa/hatch/issues/1230 for discussion
# the source distribution will include most of the files in the root directory
[tool.hatch.build.targets.sdist]
exclude = [".venv*", ".github"]
# the wheel will only include the src/chango package
[tool.hatch.build.targets.wheel]
packages = ["src/chango"]

# RUFF:
[tool.ruff]
line-length = 99
show-fixes = true

[tool.ruff.lint]
preview = true
explicit-preview-rules = true
select = ["E", "F", "I", "PL", "UP", "RUF", "PTH", "C4", "B", "PIE", "SIM", "RET", "RSE",
          "G", "ISC", "PT", "ASYNC", "TCH", "SLOT", "PERF", "PYI", "FLY", "AIR", "RUF022",
          "RUF023", "Q", "INP", "W", "YTT", "DTZ", "ARG"]
ignore = ["ISC001", "DTZ011"]

[tool.ruff.lint.isort]
split-on-trailing-comma = false

[tool.ruff.lint.per-file-ignores]
"docs/**.py" = ["INP001"]
"tests/**.py" = ["PLR0913", "ARG005"]
"tests/data/**.py" = ["INP001"]

[tool.ruff.format]
docstring-code-format = true
skip-magic-trailing-comma = true

# MYPY:
[tool.mypy]
warn_unused_ignores = true
warn_unused_configs = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
disallow_untyped_decorators = true
show_error_codes = true
python_version = "3.12"

# PYTEST:
[tool.pytest.ini_options]
pythonpath= ["src", "tests"]

# COVERAGE:
[tool.coverage.run]
source_pkgs = ["chango"]
branch = true
parallel = true

[tool.coverage.report]
exclude_also = [
  "@overload",
  "@abstractmethod",
  "if TYPE_CHECKING:",
  "class .*\\bProtocol\\):",
  "if __name__ == .__main__.:"
]

# CHANGO
[tool.chango]
sys_path = "changes"
chango_instance = { name= "chango_instance", module = "config" }
