[build-system]
build-backend = "setuptools.build_meta"
requires = [
  "setuptools>=77",
]

[project]
name = "django-cors-headers"
version = "4.9.0"
description = "django-cors-headers is a Django application for handling the server headers required for Cross-Origin Resource Sharing (CORS)."
readme = "README.rst"
keywords = [
  "api",
  "cors",
  "django",
  "middleware",
  "rest",
]
license = "MIT"
license-files = [ "LICENSE" ]
maintainers = [
  { name = "Adam Johnson", email = "me@adamj.eu" },
]
authors = [
  { name = "Otto Yiu", email = "otto@live.ca" },
]
requires-python = ">=3.9"
classifiers = [
  "Development Status :: 5 - Production/Stable",
  "Environment :: Web Environment",
  "Framework :: Django",
  "Framework :: Django :: 4.2",
  "Framework :: Django :: 5.0",
  "Framework :: Django :: 5.1",
  "Framework :: Django :: 5.2",
  "Framework :: Django :: 6.0",
  "Intended Audience :: Developers",
  "Natural Language :: English",
  "Operating System :: OS Independent",
  "Programming Language :: Python :: 3 :: Only",
  "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 :: Implementation :: CPython",
  "Typing :: Typed",
]
dependencies = [
  "asgiref>=3.6",
  "django>=4.2",
]
urls.Changelog = "https://github.com/adamchainz/django-cors-headers/blob/main/CHANGELOG.rst"
urls.Funding = "https://adamj.eu/books/"
urls.Repository = "https://github.com/adamchainz/django-cors-headers"

[dependency-groups]
test = [
  "asgiref>=3.6",
  "coverage[toml]",
  "pytest",
  "pytest-django",
  "pytest-randomly",
]
django42 = [ "django>=4.2a1,<5; python_version>='3.8'" ]
django50 = [ "django>=5.0a1,<5.1; python_version>='3.10'" ]
django51 = [ "django>=5.1a1,<5.2; python_version>='3.10'" ]
django52 = [ "django>=5.2a1,<6; python_version>='3.10'" ]
django60 = [ "django>=6.0a1,<6.1; python_version>='3.12'" ]

[tool.ruff]
lint.select = [
  # flake8-bugbear
  "B",
  # flake8-comprehensions
  "C4",
  # pycodestyle
  "E",
  # Pyflakes errors
  "F",
  # isort
  "I",
  # flake8-simplify
  "SIM",
  # flake8-tidy-imports
  "TID",
  # pyupgrade
  "UP",
  # Pyflakes warnings
  "W",
]
lint.ignore = [
  # flake8-bugbear opinionated rules
  "B9",
  # line-too-long
  "E501",
  # suppressible-exception
  "SIM105",
  # if-else-block-instead-of-if-exp
  "SIM108",
]
lint.extend-safe-fixes = [
  # non-pep585-annotation
  "UP006",
]
lint.isort.required-imports = [ "from __future__ import annotations" ]

[tool.pyproject-fmt]
max_supported_python = "3.14"

[tool.pytest.ini_options]
addopts = """\
    --strict-config
    --strict-markers
    --ds=tests.settings
    """
django_find_project = false
xfail_strict = true

[tool.coverage.run]
branch = true
parallel = true
source = [
  "corsheaders",
  "tests",
]

[tool.coverage.paths]
source = [
  "src",
  ".tox/**/site-packages",
]

[tool.coverage.report]
show_missing = true

[tool.mypy]
enable_error_code = [
  "ignore-without-code",
  "redundant-expr",
  "truthy-bool",
]
mypy_path = "src/"
namespace_packages = false
strict = true
warn_unreachable = true

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

[tool.rstcheck]
report_level = "ERROR"

[tool.uv]
conflicts = [
  [
    { group = "django42" },
    { group = "django50" },
    { group = "django51" },
    { group = "django52" },
    { group = "django60" },
  ],
]
