[project]
name = "samplics"
version = "0.4.39"
description = "Select, weight and analyze complex sample data"

authors = [{ name = "Mamadou S Diallo", email = "msdiallo@samplics.org" }]

readme = "README.md"
requires-python = ">=3.10"


keywords = ["sampling", "sample", "weighting", "estimation", "survey"]

classifiers = [
    "Programming Language :: Python :: Implementation :: CPython",
    "Programming Language :: Python :: 3.10",
    "Programming Language :: Python :: 3.11",
    "Programming Language :: Python :: 3.12",
    "Programming Language :: Python :: 3.13",
    "Development Status :: 4 - Beta",
    "Operating System :: OS Independent",
    "Topic :: Scientific/Engineering",
]

dependencies = ["numpy >=2.1", "statsmodels >=0.14", "polars[pyarrow]>=1.21.0"]

[dependency-groups]
dev = ["pytest>=8.3.3", "pytest-cov>=4.1", "codecov>=2.1", "jupyterlab>=4.3.5"]


[project.urls]
repository = "https://github.com/survey-methods/samplics"
documentation = "https://samplics-org.github.io/samplics/"
homepage = "https://samplics-org.github.io/samplics//"


[tool.black]
exclude = '''
/(
    \.eggs
  | \.git
  | \.hg
  | \.mypy_cache
  | \.tox
  | \.venv
  | _build
  | buck-out
  | build
  | dist
)/
'''
# line-length = 99
# target-version = ["py310", "py311"]

[tool.pytest.ini_options]
addopts = "--ignore=tests/apis --ignore=tests/sae --ignore=tests/types"

# testpaths = ["tests"]


[tool.ruff]
src = ["src", "tests"]
# extend-exclude = ["tests"]
line-length = 99
target-version = "py313"

[tool.ruff.lint]
# Enable pycodestyle (`E`) and Pyflakes (`F`) codes by default.
select = ["D", "E", "F", "W", "I001"]
ignore = ["D", "E501"]                # for development we can ignore the docs

# Allow autofix for all enabled rules (when `--fix`) is provided.
fixable = [
    "A",
    "B",
    "C",
    "D",
    "E",
    "F",
    "G",
    "I",
    "N",
    "Q",
    "S",
    "T",
    "W",
    "ANN",
    "ARG",
    "BLE",
    "COM",
    "DJ",
    "DTZ",
    "EM",
    "ERA",
    "EXE",
    "FBT",
    "ICN",
    "INP",
    "ISC",
    "NPY",
    "PD",
    "PGH",
    "PIE",
    "PL",
    "PT",
    "PTH",
    "PYI",
    "RET",
    "RSE",
    "RUF",
    "SIM",
    "SLF",
    # "TCH",
    "TID",
    "TRY",
    "UP",
    "YTT",
]

# Exclude a variety of commonly ignored directories.
exclude = [
    ".bzr",
    ".direnv",
    ".eggs",
    ".git",
    ".hg",
    ".mypy_cache",
    ".nox",
    ".pants.d",
    ".pytype",
    ".ruff_cache",
    ".svn",
    ".tox",
    ".venv",
    "__pypackages__",
    "_build",
    "buck-out",
    "build",
    "dist",
    "node_modules",
    "venv",
]
per-file-ignores = {}

# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

[tool.ruff.lint.pycodestyle]
ignore-overlong-task-comments = true
[tool.ruff.lint.mccabe]
# Unlike Flake8, default to a complexity level of 10.
max-complexity = 10

[tool.ruff.lint.isort]
known-first-party = ["samplics"]
known-third-party = [
    "matplotlib",
    "numpy",
    "pandas",
    "polars",
    "pydantic",
    "scipy",
    "statsmodels",
]
lines-after-imports = 2
lines-between-types = 1

[tool.mypy]
ignore_missing_imports = true
follow_imports = "silent"
strict_optional = true
allow_redefinition = true
show_error_context = false
show_column_numbers = true
# Ensure full coverage
disallow_untyped_calls = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
disallow_untyped_decorators = true
# Restrict dynamic typing
disallow_any_generics = false
warn_no_return = true
warn_return_any = true
no_implicit_optional = true
# Know what you are doing
warn_unreachable = true
warn_redundant_casts = true
warn_unused_ignores = true
warn_unused_configs = true
exclude = [".venv", "tests"]

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

[tool.hatch.build.targets.sdist]
sources = ["src"]
exclude = ["tests", "tests/*"]

[tool.hatch.build.targets.wheel]
sources = ["src"]
exclude = ["tests", "tests/*"]

# [[tool.uv.index]]
# name = "testpypi"
# url = "https://test.pypi.org/simple/"
# publish-url = "https://test.pypi.org/legacy/"
