# SPDX-FileCopyrightText: 2018 Free Software Foundation Europe e.V. <https://fsfe.org>
# SPDX-FileCopyrightText: 2022 Alliander N.V. <https://www.alliander.com>
# SPDX-FileCopyrightText: 2022 Carmen Bianca Bakker <carmenbianca@fsfe.org>
# SPDX-FileCopyrightText: 2023 DB Systel GmbH
#
# SPDX-License-Identifier: GPL-3.0-or-later

[tool.poetry]
name = "reuse"
version = "6.2.0"
description = "reuse is a tool for compliance with the REUSE recommendations."
authors = [
    "Free Software Foundation Europe <contact@fsfe.org>",
]
maintainers = [
    "Carmen Bianca Bakker <carmenbianca@fsfe.org>",
    "Max Mehl <max.mehl@fsfe.org>",
    "Linus Sehn <linus@fsfe.org>",
]
license = "Apache-2.0 AND CC0-1.0 AND CC-BY-SA-4.0 AND GPL-3.0-or-later"
readme = "README.md"

packages = [
    { include = "reuse", from = "src" }
]
include = [
    { path = "src/reuse/locale/**/*.mo", format="wheel" },
    { path = "tests", format = "sdist" },
    { path = "po", format = "sdist" },
    { path = "AUTHORS.rst", format = "sdist" },
    { path = "README.md", format = "sdist" },
    { path = "CHANGELOG.md", format = "sdist" },
    { path = "CONTRIBUTING.md", format = "sdist" },
    { path = ".reuse", format = "sdist" },
    { path = "REUSE.toml", format = "sdist" },
    { path = "LICENSES", format = "sdist" },
    { path = "docs", format = "sdist" },
]

homepage = "https://reuse.software/"
repository = "https://github.com/fsfe/reuse-tool"
documentation = "https://reuse.readthedocs.org/"

classifiers = [
    "Development Status :: 5 - Production/Stable",
    "Intended Audience :: Developers",
    "License :: OSI Approved",
    "License :: DFSG approved",
    "License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication",
    "License :: OSI Approved :: Apache Software License",
    "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
]

[tool.poetry.dependencies]
python = ">=3.10"
Jinja2 = ">=3.0.0"
license-expression = ">=21.6.14"
python-debian = ">=0.1.48"
# TODO: Consider removing this dependency in favour of tomllib when dropping
# Python 3.10.
tomlkit = ">=0.8"
attrs = ">=23.2"
click = ">=8.1"

# TODO: In the future, with PEP 631, I can declare "python-magic>=0.4.12 ; extra
# not in (x, y, z)", making it conditionally optional.
#
# Hi maintainers! python-magic is strictly speaking optional, and will not
# import if libmagic is not available. One of the other modules below will be
# used as fallback, in the below order. If you do not want a dependency on
# python-magic, you can patch out this requirement and instead hard-require one
# of the fallbacks.
python-magic = ">=0.4.12"
# Annoyingly, file-magic has the same module namespace as python-magic
# ('magic'). If both are installed simultaneously, it is not self-evident which
# of the two is imported. file-magic is the 'official' magic module.
file-magic = { version = ">=0.4.1", optional = true }
charset-normalizer = { version = ">=2.0.5", optional = true }
chardet = { version = ">=3.0.2", optional = true }

[tool.poetry.extras]
file-magic = ["file-magic"]
charset-normalizer = ["charset-normalizer"]
chardet = ["chardet"]

[tool.poetry.group.test.dependencies]
pytest = ">=6.0.0"
pytest-cov = ">=2.10.0"
freezegun = ">=1.0.0"

[tool.poetry.group.docs.dependencies]
Sphinx = ">=4.0.0"
myst-parser = ">=2.0.0"
sphinxcontrib-apidoc = ">=0.3.0"
furo = ">=2023.3.27"

[tool.poetry.group.dev.dependencies]
black = ">=20"
isort = ">=5.6.0"
pre-commit = ">=2.9.0"
bumpver = ">=2023.1129"
pylint = ">=2.12.2"
mypy = ">=1.0"
GitPython = ">=3.0"
protokolo = { version = ">=3.0.2", python = ">=3.11" }

[tool.poetry.group.lsp]
optional = true

[tool.poetry.group.lsp.dependencies]
python-lsp-server = "*"
pylsp-mypy = "*"
pyls-isort = "*"
python-lsp-black = "*"

[tool.poetry.scripts]
reuse = "reuse.cli.main:main"

[tool.poetry.build]
generate-setup-file = false
script = "_build.py"

[build-system]
requires = ["poetry-core>=1.1.0"]
build-backend = "poetry.core.masonry.api"

[bumpver]
current_version = "v6.2.0"
version_pattern = "vMAJOR.MINOR.PATCH[PYTAGNUM]"
commit_message = "Bump version: {old_version} → {new_version}"
tag_message = "{new_version}"
tag_scope = "default"
pre_commit_hook = ""
post_commit_hook = ""
commit = true
tag = false
push = false

[bumpver.file_patterns]
"pyproject.toml" = [
    '^version = "{pep440_version}"$',
    '^current_version = "{version}"$',
]
"src/reuse/__init__.py" = [
    '__version__ = "{pep440_version}"$',
]
"docs/conf.py" = [
    'release = "{pep440_version}"$',
]
"README.md" = [
    'rev: {version}$',
]

[tool.protokolo]
changelog = "CHANGELOG.md"
markup = "markdown"
directory = "changelog.d"

[tool.black]
line-length = 80

[tool.isort]
multi_line_output = 3
include_trailing_comma = true
force_grid_wrap = 0
use_parentheses = true
line_length = 80

[tool.pytest.ini_options]
addopts = "--doctest-modules"

[tool.mypy]
files = [
    "src/reuse/**/*.py",
    "tests/**/*.py",
]
exclude = [
    '^_build\.py$',
    '^conf\.py$',
]
check_untyped_defs = true

[[tool.mypy.overrides]]
module = "reuse.*"
disallow_untyped_defs = true
disallow_incomplete_defs = true

[[tool.mypy.overrides]]
module = [
    "binaryornot.check",
    "boolean.boolean",
    "license_expression",
    "pkg_resources",
]
ignore_missing_imports = true
