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

[project]
name = "membersystem"
description = ''
readme = "README.md"
requires-python = ">=3.11"
keywords = []
authors = [
    { name = "Víðir Valberg Guðmundsson", email = "valberg@orn.li" },
]
dependencies = [
    "Django==5.0.1",
    "django-money==3.4.1",
    "django-allauth==0.60.0",
    "psycopg[binary]==3.1.16",
    "environs[django]==10.0.0",
    "uvicorn==0.25.0",
    "whitenoise==6.6.0",
    "django-zen-queries==2.1.0",
    "django-registries==0.0.3",
    "django-view-decorator==0.0.4",
    "django-oauth-toolkit==2.3.0",
]
version = "0.0.1"

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

[tool.hatch.envs.default]
dependencies = [
    "coverage[toml]==7.3.0",
    "pytest==7.2.2",
    "pytest-cov",
    "pytest-django==4.5.2",
    "mypy==1.1.1",
    "django-stubs==1.16.0",
    "pip-tools==7.3.0",
    "django-debug-toolbar==4.2.0",
    "django-browser-reload==1.7.0",
    "model-bakery==1.17.0",
]

[[tool.hatch.envs.tests.matrix]]
python = ["3.12"]
django = ["4.2", "5.0"]

[tool.hatch.envs.tests.overrides]
matrix.django.dependencies = [
    { value = "django~={matrix:django}" },
]
matrix.python.dependencies = [
    { value = "typing_extensions==4.5.0", if = ["3.10"]},
]

[tool.hatch.envs.default.scripts]
cov = "pytest --cov-report=term-missing --cov-config=pyproject.toml --cov=src --cov=tests --cov=append {args}"
no-cov = "cov --no-cov {args}"
typecheck = "mypy --config-file=pyproject.toml ."
requirements = "pip-compile --output-file requirements/base.txt pyproject.toml"
server = "./src/manage.py runserver 0.0.0.0:8000"
migrate = "./src/manage.py migrate"
makemigrations = "./src/manage.py makemigrations"
createsuperuser = "./src/manage.py createsuperuser"
shell = "./src/manage.py shell"

[tool.pytest.ini_options]
DJANGO_SETTINGS_MODULE="tests.settings"
addopts = "--reuse-db"
norecursedirs = "build dist docs .eggs/* *.egg-info htmlcov .git"
python_files = "test*.py"
testpaths = "tests"
pythonpath = ". tests"

[tool.coverage.run]
branch = true
parallel = true

[tool.coverage.report]
exclude_lines = [
    "no cov",
    "if __name__ == .__main__.:",
    "if TYPE_CHECKING:",
]

[tool.mypy]
mypy_path = "src/"
exclude = [
    "venv/",
    "dist/",
    "docs/",
]
namespace_packages = false
show_error_codes = true
strict = true
warn_unreachable = true
follow_imports = "normal"
#plugins = ["mypy_django_plugin.main"]

[tool.django-stubs]
#django_settings_module = "tests.settings"

[[tool.mypy.overrides]]
module = "tests.*"
allow_untyped_defs = true

[tool.ruff]
target-version = "py312"
extend-exclude = [
    ".git",
    "__pycache__",
]
line-length = 120

[tool.ruff.lint]
select = ["ALL"]
ignore = [
    "G004", # Logging statement uses f-string
    "ANN101", # Missing type annotation for `self` in method
    "ANN102", # Missing type annotation for `cls` in classmethod
    "EM101", # Exception must not use a string literal, assign to variable first
    "EM102", # Exception must not use a f-string literal, assign to variable first
    "COM812", # missing-trailing-comma (https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules)
    "ISC001", # single-line-implicit-string-concatenation (https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules)
]

[tool.ruff.lint.isort]
force-single-line = true
