# SPDX-FileCopyrightText: (c) TagStudio Contributors
# SPDX-License-Identifier: GPL-3.0-only


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

[project]
name = "TagStudio"
description = "A User-Focused Photo & File Management System."
version = "9.6.1"
license = "GPL-3.0-only"
readme = "README.md"
requires-python = ">=3.12,<3.14"
dependencies = [
    "audioop-lts; python_version >= '3.13'",
    "chardet~=5.2",
    "ffmpeg-python~=0.2",
    "humanfriendly==10.*",
    "mutagen~=1.47",
    "numpy~=2.2",
    "opencv_python~=4.11",
    "Pillow>=10.2,<12",
    "pillow-heif~=0.22",
    "pillow-jxl-plugin~=1.3",
    "py7zr~=1.1.3",
    "pydantic~=2.10",
    "pydub~=0.25",
    "PySide6==6.8.0.*",
    "rarfile==4.2",
    "rawpy~=0.27",
    "Send2Trash>=1.8,<3",
    "SQLAlchemy~=2.0",
    "srctools~=2.6",
    "structlog~=25.3",
    "toml~=0.10",
    "typing_extensions~=4.13",
    "ujson~=5.10",
    "wcmatch==10.*",
    "requests~=2.31.0",
    "semver~=3.0.4",
]

[project.gui-scripts]
tagstudio = "tagstudio.main:main"

[dependency-groups]
all = [
    { include-group = "check" },
    { include-group = "build" },
    { include-group = "docs" },
    { include-group = "extra" },
]
check = [{ include-group = "lint" }, { include-group = "test" }]

build = [{ include-group = "pyinstaller" }]
docs = [{ include-group = "mkdocs" }]
extra = [{ include-group = "pre-commit" }]
lint = [{ include-group = "pyright" }, { include-group = "ruff" }]
test = [{ include-group = "pytest" }]

mkdocs = ["mkdocs-material[imaging]>=9.7", "mkdocs-redirects~=1.2"]
pre-commit = ["pre-commit~=4.2"]
pyinstaller = ["Pyinstaller~=6.21"]
pyright = ["pyright~=1.1.409"]
pytest = [
    "pytest==9.0.3",
    "pytest-cov==6.1.1",
    "pytest-mock==3.15.1",
    "pytest-qt==4.4.0",
    "syrupy==5.1.0",
]
ruff = ["ruff==0.15.17"]

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

[tool.pytest]
qt_api = "pyside6"
pythonpath = ["src"]
filterwarnings = [
    "ignore:DISTINCT ON is currently supported only by the PostgreSQL dialect:sqlalchemy.exc.SADeprecationWarning",
    'ignore:Invoking or_\(\) without arguments is deprecated:sqlalchemy.exc.SADeprecationWarning',
]

[tool.pyright]
ignore = [
    ".venv/**",
    "src/tagstudio/core/library/json/",
    "src/tagstudio/qt/previews/vendored/pydub/",
]
include = ["src/tagstudio", "tests"]
# Reference for the settings here: https://github.com/microsoft/pyright/blob/main/docs/configuration.md
# Some rules exclusive to basedpyright: https://docs.basedpyright.com/latest/benefits-over-pyright/new-diagnostic-rules/
reportAny = false
reportIgnoreCommentWithoutRule = false
reportImplicitStringConcatenation = false
reportImportCycles = false
reportMissingTypeArgument = false
reportMissingTypeStubs = false
# reportOptionalMemberAccess = false
reportUnknownArgumentType = false
reportUnknownLambdaType = false
reportUnknownMemberType = false
reportUnusedCallResult = false
reportUnannotatedClassAttribute = false
reportUninitializedInstanceVariable = false

[tool.ruff]
exclude = ["home_ui.py", "resources.py", "resources_rc.py"]
line-length = 100

[tool.ruff.lint]
select = ["B", "D", "E", "F", "FBT003", "I", "N", "SIM", "T20", "UP"]
ignore = ["D100", "D101", "D102", "D103", "D104", "D105", "D106", "D107"]

[tool.ruff.lint.per-file-ignores]
"tests/**" = ["D", "E402"]
"src/tagstudio/qt/previews/vendored/**" = ["B", "E", "N", "UP", "SIM115"]

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