[build-system]
requires = ["hatchling>=1.27.0", "hatch-vcs"]
build-backend = "hatchling.build"

[project]
name = "recurring-ical-events"
license = "LGPL-3.0-or-later"
license-files = ["LICENSE"]
keywords = ["icalendar", "calendar", "ics", "rfc5545", "scheduling", "events", "todo", "journal", "alarm"]
dynamic = ["urls", "version"]
authors = [
  { name="Nicco Kunzmann", email="niccokunzmann@rambler.ru" },
]
maintainers = [
  { name="Nicco Kunzmann", email="niccokunzmann@rambler.ru" },
]
description = "Calculate recurrence times of events, todos, alarms and journals based on icalendar RFC5545."
readme = "README.rst"
requires-python = ">=3.8"

# see https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers = [
    "Development Status :: 5 - Production/Stable",
    "Intended Audience :: Developers",
    "Operating System :: OS Independent",
    "Topic :: Office/Business :: Scheduling",
    "Intended Audience :: Developers",
    "Topic :: Software Development :: Libraries :: Python Modules",
    "Topic :: Utilities",
    "Natural Language :: English",
    "Programming Language :: Python :: 3",
    "Programming Language :: Python :: 3 :: Only",
    "Programming Language :: Python :: 3.8",
    "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",
]

# install requirements depending on python version
# see https://www.python.org/dev/peps/pep-0508/#environment-markers
dependencies = [
    'icalendar >= 6.1.0, < 8.0.0',
    'python-dateutil >= 2.8.1, < 3.0.0',
    'x-wr-timezone >= 1.0.0, < 3.0.0; python_version >= "3.9"',
    'x-wr-timezone == 0.*; python_version <= "3.8"',
    'backports.zoneinfo; python_version == "3.7" or python_version == "3.8"',
    'tzdata',
    'typing_extensions; python_version <= "3.9"',
]

[project.optional-dependencies]
test = [
    'pytest',
    'pytest-cov',
    'restructuredtext-lint',
    'pygments',
    'pytz >= 2023.3',
]

[tool.hatch.metadata.hooks.vcs.urls]
#[project.urls]
Homepage = "https://recurring-ical-events.readthedocs.io/"
Repository = "https://github.com/niccokunzmann/python-recurring-ical-events"
"Source Archive" = "https://github.com/niccokunzmann/python-recurring-ical-events/archive/{commit_hash}.zip"
Issues = "https://github.com/niccokunzmann/python-recurring-ical-events/issues"
Documentation = "https://github.com/niccokunzmann/python-recurring-ical-events"
Changelog = "https://github.com/niccokunzmann/python-recurring-ical-events?tab=readme-ov-file#changelog"
"Fund with GitHub Sponsors" = "https://github.com/sponsors/niccokunzmann"
"Fund with Polar" = "https://polar.sh/niccokunzmann/python-recurring-ical-events"
"Fund with Open Collective" = "https://opencollective.com/open-web-calendar"
"Fund with Tidelift" = "https://tidelift.com/funding/github/pypi/recurring-ical-events"

[tool.hatch.version]
source = "vcs"

[tool.hatch.version.raw-options]
# see https://github.com/ofek/hatch-vcs/issues/43#issuecomment-1553065222
local_scheme = "no-local-version"

[tool.hatch.build.hooks.vcs]
version-file = "recurring_ical_events/_version.py"

[tool.hatch.metadata]
allow-direct-references = true

[tool.ruff]
target-version = "py38"

[tool.ruff.lint]
select = ["ALL"]
ignore = [
    "ANN",     # flake8-annotations
    "B020",    # Loop control variable {name} overrides iterable it iterates
    "C401",    # Unnecessary generator (rewrite as a set comprehension)
    "C901",    # {name} is too complex ({complexity} > {max_complexity})
    "COM812",  # Trailing comma missing
    "D1",      # Missing docstring
    "D2",      # docstrings stuffs
    "D4",      # docstrings stuffs
    "EM10",    # Exception string usage
    "ERA001",  # Found commented-out code
    "FBT002",  # Boolean default positional argument in function definition
    "FIX",     # TODO comments
    "ISC001",  # Implicitly concatenated string literals on one line (to avoid with formatter)
    "N818",    # Exception name {name} should be named with an Error suffix
    "PLR091",  # Too many things (complexity, arguments, branches, etc...)
    "PLR2004", # Magic value used in comparison, consider replacing {value} with a constant variable
    "RUF012",  # Mutable class attributes should be annotated with typing.ClassVar
    "RUF015",  # Prefer next({iterable}) over single element slice
    "S101",    # Use of assert detected
    "TD",      # TODO comments
    "TRY003",  # Avoid specifying long messages outside the exception class
    "UP007",   # Use | None instead of Optional
]
extend-safe-fixes = [
    "PT006", # Wrong type passed to first argument of @pytest.mark.parametrize; expected {expected_string}
]

[tool.ruff.lint.per-file-ignores]
"recurring_ical_events/test/*" = [
    "B011",   # Do not assert False (python -O removes these calls), raise AssertionError()
    "DTZ001", # datetime.datetime() called without a tzinfo argument
    "E501",   # Indentation is not a multiple of {indent_size}
    "N802",   # Function name {name} should be lowercase
    "PT011",  # pytest.raises({exception}) is too broad, set the match parameter or use a more specific exception
    "PT012",  # pytest.raises() block should contain a single simple statement
    "PT015",  # Assertion always fails, replace with pytest.fail()
    "T201",   # print found
    "N803",   # ZoneInfo should be lowercase
]
"example.py" = [
    "T201", # print found
]
