[project]
name = "lice2"
version = "0.13.0"
description = "Generate license files for your projects"
authors = [{ name = "Grant Ramsay", email = "grant@gnramsay.com" }]
license = "BSD-3-Clause"
readme = "README.md"
requires-python = ">=3.9"

classifiers = [
  "Development Status :: 4 - Beta",
  "Intended Audience :: Developers",
  "License :: OSI Approved :: BSD License",
  "Operating System :: OS Independent",
  "Programming Language :: Python :: 3",
  "Programming Language :: Python :: 3.9",
  "Programming Language :: Python :: 3.10",
  "Programming Language :: Python :: 3.11",
  "Programming Language :: Python :: 3.12",
]
dependencies = [
  "pyperclip>=1.9.0",
  "rich>=13.8.0",
  "simple-toml-settings>=0.8.0",
  "single-source>=0.4.0",
  "typer>=0.12.5",
]

[project.urls]
"repository" = "https://github.com/seapagan/lice2"
"homepage" = "https://seapagan.github.io/lice2/"
"Pull Requests" = "https://github.com/seapagan/lice2/pulls"
"Bug Tracker" = "https://github.com/seapagan/lice2/issues"
"Changelog" = "https://github.com/seapagan/lice2/blob/main/CHANGELOG.md"

[project.scripts]
lice = "lice2.core:app"

[tool.uv]
dev-dependencies = [
  "mypy >= 1.11.2",
  "pre-commit >= 3.8.0",
  "ruff >= 0.7.3",
  "pymarkdownlnt >= 0.9.22",
  "pyfakefs >= 5.6.0",
  "pytest >= 8.3.2",
  "pytest-clarity >= 1.0.1",
  "pytest-cov >= 5.0.0",
  "pytest-sugar >= 1.0.0",
  "pytest-randomly >= 3.15.0",
  "pytest-reverse >= 1.7.0",
  "pytest-mock >= 3.14.0",
  "mock >= 5.1.0",
  "poethepoet >= 0.28.0",
  "github-changelog-md >= 0.9.5",
  "mkdocs >= 1.6.1",
  "mkdocs-autorefs >= 1.2.0",
  "mkdocs-material >= 9.5.34",
  "mkdocs-minify-plugin >= 0.8.0",
  "pymdown-extensions >= 10.9",
  "pygments >= 2.18.0",
]

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


[tool.poe.tasks]
pre.cmd = "pre-commit run --all-files"
pre.help = "Run pre-commit checks"
mypy.cmd = "mypy . --strict"
mypy.help = "Run mypy checks"
format.help = "Format code with Ruff"
format.cmd = "ruff format ."
ruff.help = "Run Ruff checks"
ruff.cmd = "ruff check --output-format=concise ."

changelog.cmd = "github-changelog-md"
changelog.help = "Generate a changelog"

"docs:publish".cmd = "mkdocs gh-deploy"
"docs:publish".help = "Publish documentation to GitHub Pages"
"docs:build".cmd = "mkdocs build"
"docs:build".help = "Build documentation locally to './site' folder"
"docs:serve".cmd = "mkdocs serve -w TODO.md -w CHANGELOG.md -w CONTRIBUTING.md"
"docs:serve".help = "Serve documentation locally"
"docs:serve:all".cmd = "mkdocs serve -w TODO.md -w CHANGELOG.md -w CONTRIBUTING.md -a 0.0.0.0:9000"
"docs:serve:all".help = "Serve documentation locally on all interfaces"

[tool.pytest.ini_options]
addopts = ["--cov", "--cov-report", "term-missing", "--cov-report", "html"]
filterwarnings = [
  "ignore:pkg_resources is deprecated as an API:DeprecationWarning",
]
mock_use_standalone_module = true

[tool.coverage.run]
source = ["lice2"]
omit = ["*/tests/*"]

[tool.ruff]
line-length = 80
lint.select = ["ALL"] # we are being very strict!
lint.ignore = [
  "ANN101",
  "ANN102",
  "PGH003",
  "FBT002",
  "FBT003",
  "B006",
] # These rules are too strict even for us 😝
lint.extend-ignore = [
  "COM812",
  "ISC001",
] # these are ignored for ruff formatting

src = ["lice2"]
target-version = "py39" # minimum python version supported

[tool.ruff.format]
indent-style = "space"
quote-style = "double"

[tool.ruff.lint.pep8-naming]
classmethod-decorators = ["pydantic.validator", "pydantic.root_validator"]

[tool.ruff.lint.pydocstyle]
convention = "google"

[tool.ruff.lint.extend-per-file-ignores]
"lice2/tests/**/*.py" = [
  "S101",   # we can (and MUST!) use 'assert' in test files.
  "ANN001", # annotations for fixtures are sometimes a pain for test files
  "ARG00",  # test fixtures often are not directly used
]

[tool.ruff.lint.isort]
known-first-party = ["lice2"]

[tool.ruff.lint.pyupgrade]
keep-runtime-typing = true

[tool.mypy]
python_version = "3.9"

[[tool.mypy.overrides]]
module = "pyperclip"
ignore_missing_imports = true

[[tool.mypy.overrides]]
disable_error_code = ["method-assign", "no-untyped-def", "attr-defined"]
module = "tests.*"
