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

[project]
name = "sgn-gwframe"
authors = [
    { name = "Olivia Godwin", email = "olivia.godwin@ligo.org" },
    { name = "Chad Hanna", email = "crh184@psu.edu" },
    { name = "Yun-Jing Huang", email = "yzh5436@psu.edu" },
]
description = "Gravitational wave frame file I/O elements for sgn-ts"
readme = "README.md"
license = "LGPL-3.0-or-later"
dynamic = ["version"]
requires-python = ">=3.10"
dependencies = [
    "gpstime",
    "gwframe",
    "igwn-segments",
    "sgn >= 0.6",
    "sgn-ts >= 0.6",
    "watchdog",
]

[project.optional-dependencies]
test = [
    "pytest",
    "pytest-cov",
    "pytest-freezer",
]
docs = [
    "mkdocs >= 1.3",
    "mkdocs-coverage >= 0.2",
    "mkdocs-gen-files >= 0.3",
    "mkdocs-literate-nav >= 0.4",
    "mkdocs-material-igwn",
    "mkdocs-section-index >= 0.3",
    "mkdocstrings[python]",
    "markdown-callouts >= 0.2",
    "markdown-exec >= 0.5",
    "toml >= 0.10",
]
lint = [
    "mypy",
    "mypy-extensions",
    "pip", # mypy requires pip to install type stubs
    "ruff",
]
dev = [
    "sgn_gwframe[docs]",
    "sgn_gwframe[lint]",
    "sgn_gwframe[test]",
]

[project.entry-points.sgn_elements]
GWFrameSource = "sgn_gwframe.sources:GWFrameSource"
GWFrameWatchSource = "sgn_gwframe.sources:GWFrameWatchSource"
GWFrameSink = "sgn_gwframe.sinks:GWFrameSink"

[project.urls]
Homepage = "https://git.ligo.org/greg/sgn-gwframe"
Documentation = "https://docs.ligo.org/greg/sgn-gwframe"
Repository = "https://git.ligo.org/greg/sgn-gwframe.git"
Issues = "https://git.ligo.org/greg/sgn-gwframe/issues"

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

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

[tool.hatch.envs.default]
features = ["dev"]
installer = "uv"

[tool.hatch.envs.default.scripts]
check = "mypy --install-types --non-interactive sgn_gwframe"

[tool.hatch.envs.docs]
features = ["docs"]
scripts.build = "mkdocs build --clean --strict"
scripts.serve = "mkdocs serve"

[tool.hatch.envs.hatch-static-analysis]
config-path = "none"

[tool.hatch.envs.hatch-test]
features = ["test"]
default-args = ["sgn_gwframe/tests"]
extra-args = ["-ra", "-v", "-s"]

[[tool.hatch.envs.hatch-test.matrix]]
python = ["3.10", "3.11", "3.12"]

[tool.pytest.ini_options]
addopts = "--cov=sgn_gwframe --cov-report=term-missing"

[tool.coverage.paths]
source = [
    "src/sgn_gwframe/",
    "*/sgn_gwframe/",
]

[tool.coverage.run]
source = ["sgn_gwframe"]
omit = [
    "sgn_gwframe/tests/*",
    "__init__.py",
    "_version.py",
]

[tool.coverage.report]
# print report with one decimal point
precision = 1
show_missing = true
omit = [
    "sgn_gwframe/tests/*",
    "__init__.py",
    "_version.py",
]

[tool.mypy]
check_untyped_defs = true
ignore_missing_imports = true
exclude = [
    "docs",
    "build",
]

[tool.ruff]
line-length = 88
indent-width = 4

[tool.ruff.lint]
select = [
    # pycodestyle
    "E",
    "W",
    # pyflakes
    "F",
    # isort
    "I",
    # pep8-naming
    "N",
    # flake8-bandit
    "S",
    # flake8-blind-except
    "BLE",
    # flake8-boolean-trap
    "FBT",
    # flake8-bugbear
    "B",
    # flake8-builtins
    "A",
    # flake8-comprehensions
    "C4",
    # flake8-datetimez
    "DTZ",
    # flake8-errmsg
    "EM",
    # flake8-executable
    "EXE",
    # flake8-future-annotations
    "FA",
    # flake8-logging
    "LOG",
    # flake8-logging-format
    "G",
    # flake8-pytest-style
    "PT",
    # flake8-return
    "RET",
    # flake8-self
    "SLF",
    # flake8-simplify
    "SIM",
    # flake8-slots
    "SLOT",
    # flake8-type-checking
    "TCH",
    # tryceratops
    "TRY",
    # refurb
    "FURB",
    # ruff-specific rules
    "RUF",
]
ignore = [
    "E203",  # flags whitespace on slicing
    "S101",  # assert statements
    "B905",  # strict zip
    "C414",  # unnecessary double-cast
    "PT011",  # pytest generic raises
]

[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401"]
"tests/conftest.py" = ["E402"]
"tests/*" = ["SLF001"]
