[project]
name = "discord-reminder-bot"
version = "2.0.0"
description = "Discord bot that allows you to set date, cron and interval reminders."
readme = "README.md"
requires-python = ">=3.10"
dependencies = [
    # The Discord bot library uses discord.py
    "discord-py[speed]>=2.5.0", # https://github.com/Rapptz/discord.py

    # For parsing dates and times in /remind commands
    "dateparser>=1.0.0", # https://github.com/scrapinghub/dateparser

    # For sending webhook messages to Discord
    "discord-webhook>=1.3.1", # https://github.com/lovvskillz/python-discord-webhook

    # For scheduling reminders, sqlalchemy is needed for storing reminders in a database
    "apscheduler>=3.11.0", # https://github.com/agronholm/apscheduler
    "sqlalchemy>=2.0.37",  # https://github.com/sqlalchemy/sqlalchemy

    # For loading environment variables from a .env file
    "python-dotenv>=1.0.1", # https://github.com/theskumar/python-dotenv

    # For error tracking
    "sentry-sdk>=2.20.0", # https://github.com/getsentry/sentry-python

    # For logging
    "loguru>=0.7.3", # https://github.com/Delgan/loguru
]

[dependency-groups]
dev = ["pytest"]

[tool.poetry]
name = "discord-reminder-bot"
version = "2.0.0"
description = "Discord bot that allows you to set date, cron and interval reminders."
authors = ["Joakim Hellsén <tlovinator@gmail.com>"]
license = "GPL-3.0-or-later"

[tool.poetry.scripts]
bot = "discord_reminder_bot.main:start"

[tool.poetry.dependencies]
python = "^3.10"

# https://github.com/agronholm/apscheduler
# https://github.com/sqlalchemy/sqlalchemy
# For scheduling reminders, sqlalchemy is needed for storing reminders in a database
sqlalchemy = {version = ">=2.0.37,<3.0.0"}
apscheduler = {version = ">=3.11.0,<4.0.0"}

# https://github.com/scrapinghub/dateparser
# For parsing dates and times in /remind commands
dateparser = {version = ">=1.0.0"}

# https://github.com/Rapptz/discord.py
# https://github.com/jackrosenthal/legacy-cgi
# https://github.com/AbstractUmbra/audioop
# The Discord bot library uses discord.py
# legacy-cgi and audioop-lts are because Python 3.13 removed cgi module and audioop module
discord-py = {version = ">=2.4.0,<3.0.0", extras = ["speed"]}
legacy-cgi = {version = ">=2.6.2,<3.0.0", markers = "python_version >= '3.13'"}
audioop-lts = {version = ">=0.2.1,<1.0.0", markers = "python_version >= '3.13'"}

# https://github.com/lovvskillz/python-discord-webhook
# For sending webhook messages to Discord
discord-webhook = {version = ">=1.3.1,<2.0.0"}

# https://github.com/theskumar/python-dotenv
# For loading environment variables from a .env file
python-dotenv = {version = ">=1.0.1,<2.0.0"}

# https://github.com/getsentry/sentry-python
# For error tracking
sentry-sdk = {version = ">=2.20.0,<3.0.0"}

# https://github.com/Delgan/loguru
# For logging
loguru = {version = ">=0.7.3,<1.0.0"}

[tool.poetry.dev-dependencies]
pytest = "*"

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

[tool.ruff]
preview = true
line-length = 140
lint.select = ["ALL"]
lint.pydocstyle.convention = "google"
lint.isort.required-imports = ["from __future__ import annotations"]
lint.pycodestyle.ignore-overlong-task-comments = true

lint.ignore = [
    "CPY001",  # Checks for the absence of copyright notices within Python files.
    "D100",    # Checks for undocumented public module definitions.
    "D104",    # Checks for undocumented public package definitions.
    "D106",    # Checks for undocumented public class definitions, for nested classes.
    "ERA001",  # Checks for commented-out Python code.
    "FIX002",  # Checks for "TODO" comments.
    "PLR2004", # Checks for magic values used in comparison.

    # Conflicting lint rules when using Ruff's formatter
    # https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules
    "COM812", # Checks for the absence of trailing commas.
    "COM819", # Checks for the presence of prohibited trailing commas.
    "D206",   # Checks for docstrings that are indented with tabs.
    "D300",   # Checks for docstrings that use '''triple single quotes''' instead of """triple double quotes""".
    "E111",   # Checks for indentation with a non-multiple of 4 spaces.
    "E114",   # Checks for indentation of comments with a non-multiple of 4 spaces.
    "E117",   # Checks for over-indented code.
    "ISC001", # Checks for implicitly concatenated strings on a single line.
    "ISC002", # Checks for implicitly concatenated strings that span multiple lines.
    "Q000",   # Checks for inline strings that use single quotes or double quotes, depending on the value of the lint.flake8-quotes.inline-quotes option.
    "Q001",   # Checks for multiline strings that use single quotes or double quotes, depending on the value of the lint.flake8-quotes.multiline-quotes setting.
    "Q002",   # Checks for docstrings that use single quotes or double quotes, depending on the value of the lint.flake8-quotes.docstring-quotes setting.
    "Q003",   # Checks for strings that include escaped quotes, and suggests changing the quote style to avoid the need to escape them.
    "W191",   # Checks for indentation that uses tabs.
]

[tool.ruff.format]
docstring-code-format = true
docstring-code-line-length = 20

[tool.ruff.lint.per-file-ignores]
"**/test_*.py" = [
    "ARG",     # Unused function args -> fixtures nevertheless are functionally relevant...
    "FBT",     # Don't care about booleans as positional arguments in tests, e.g. via @pytest.mark.parametrize()
    "PLR2004", # Magic value used in comparison, ...
    "S101",    # asserts allowed in tests...
    "S311",    # Standard pseudo-random generators are not suitable for cryptographic purposes
]

[tool.pytest.ini_options]
log_cli = true
log_cli_level = "INFO"
log_cli_format = "%(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(lineno)s)"
log_cli_date_format = "%Y-%m-%d %H:%M:%S"
filterwarnings = [
    "ignore:Parsing dates involving a day of month without a year specified is ambiguious:DeprecationWarning:dateparser\\.utils\\.strptime",
    "ignore::DeprecationWarning:aiohttp.cookiejar",
]