# * -------------------------------------------------------------------------------- * #
# * Changes below should persist in significant template updates.

# * -------------------------------------------------------------------------------- * #
# * Changes below may be lost in significant template updates.

[build-system]
requires = ["flit_core >=3.3,<4"]
build-backend = "flit_core.buildapi"

[project]
name = "{{ project_name }}"
version = "{{ project_version }}"
description = "{{ project_description }}"
readme = "README.md"
license = { file = "LICENSE" }
requires-python = ">={{ python_version }}"
classifiers = ["License :: OSI Approved :: MIT License"]
[[project.authors]]
name = "{{ project_owner_name }}"
{% if project_email %}email = "{{ project_email }}"{% endif %}
[project.urls]
Changes = "https://{{ project_owner_github_username }}.github.io/{{ github_repo_name }}/changelog.html"
Docs = "https://{{ project_owner_github_username }}.github.io/{{ github_repo_name }}"
Home = "https://github.com/{{ project_owner_github_username }}/{{ github_repo_name }}"
Tracker = "https://github.com/{{ project_owner_github_username }}/{{ github_repo_name }}/issues"

[tool.ruff]
fix = true
select = ["ALL"]
src = ["src", "tests"]
target-version = "py311"
extend-exclude = ["template", "typings", ".github", ".tools", ".venv"]
ignore = [
    # * ---------------------------------------------------------------------------- * #
    # * Changes below should persist in significant template updates.

    # * ---------------------------------------------------------------------------- * #
    # * Changes below may be lost in significant template updates.

    "ANN",     # Don't require type annotations
    "ARG005",  # Allow unused lambda argument. For consistency across df pipelines.
    "C408",    # Allow dict calls
    "COM",     # Allow magic commas and magic missing commas
    "D10",     # Missing docstrings
    "D20",     # Don't reformat docstrings in these ways
    "D213",    # Multi-line docstring summary should start at the second line
    "D402",    # False positives for parens in first line
    "DTZ",     # Timezones are important, but only contextually necessary.
    "E501",    # Don't check line length. Black handles this.
    "EM",      # Don't check for exception message issues
    "ERA",     # False positives. Don't get rid of commented out code.
    "FBT",     # Allow boolean "traps"
    "F841",    # Don't check for or fix unused variables
    "G0",      # Allow f-strings, etc. in Loguru logging
    "INP001",  # False positives. Checks for packages missing `__init__.py`
    "ISC",     # False positives. Implicit string concatenation is fine.
    "PD013",   # Allow `stack` instead of `melt`. They're not a direct swap.
    "PD901",   # Allow `df` variable name. We are all consenting adults here.
    "PD011",   # Allow use of `.values`. False positives.
    "PGH003",  # Until black stops wrapping special ignores, let's allow bare
    "PIE804",  # Allow dict unpack even if unnecessary, consisent for df.assign{**...}
    "PLR0913", # Allow more than five function arguments
    "PLR2004", # Allow magic values. This check is too sensitive
    "PLW2901", # For loop variable
    "RET",     # Return checks are flaky, Sourcery does fine analysing these paths
    "S301",    # Don't warn about pickling. Allow me to shoot myself in the foot.
    "TCH",     # Type checking linter doesn't play nicely with pydantic
    "TD",      # Disable to-do validation. Too pedantic for now.
    "TRY003",  # Allow long exception messages
    "W2",      # Allow whitespace issues. Fixed automatically by black.
    # * ---------------------------------------------------------------------------- * #
    # * These Jupyter-specific ignores can't be per-file-ignores
    # * https://nbqa.readthedocs.io/en/latest/known-limitations.html
    "B018", # Allow "useless" expressions, which do suppress outputs in notebooks
    "F821", # Allow undefined names, such as `display`
    "S101", # Allow assert
    "T201", # Allow print in notebooks
]
unfixable = [
    # * ---------------------------------------------------------------------------- * #
    # * Changes below should persist in significant template updates.

    # * ---------------------------------------------------------------------------- * #
    # * Changes below may be lost in significant template updates.

    "F601", # Don't fix duplicate mapping keys
]

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

[tool.ruff.isort]
# * ---------------------------------------------------------------------------- * #
# * Changes below should persist in significant template updates.

# * ---------------------------------------------------------------------------- * #
# * Changes below may be lost in significant template updates.
split-on-trailing-comma = false

[tool.ruff.per-file-ignores]
"docs/**" = [
    "E402", # Need to allow imports below patches in docs notebooks
]
"tests/**" = [
    # * ---------------------------------------------------------------------------- * #
    # * Changes below should persist in significant template updates.

    # * ---------------------------------------------------------------------------- * #
    # * Changes below may be lost in significant template updates.

    "ARG001", # Allow unused arguments in tests
    "S101",   # Allow assert in tests
]

[tool.ruff.flake8-bugbear]
extend-immutable-calls = ["typer.Argument", "typer.Option"]

[tool.ruff.pep8-naming]
classmethod-decorators = ["pydantic.validator"]
