[project]
name = "abacus-models"
version = "1.2.1"
description = "SQLAlchemy Models for Abacus."
authors = [
    {name = "The Orchard", email = "webdev@theorchard.com"}
]
readme = "README.md"
requires-python = ">=3.10"

dependencies = [
  "sqlalchemy~=2.0",
]

[project.urls]
Repository = "https://github.com/theorchard/python-abacus-models"

[dependency-groups]
dev = [
  "bump-my-version~=1.3",
  "mypy~=1.20",
  "pymysql~=1.1",
  "pytest>=9.0.3,<10",
  "pytest-cov~=6.2",
  "python-dotenv~=1.2",
  "ruff~=0.15",
  "snowflake-connector-python>=3.12,<5",
  "snowflake-sqlalchemy~=1.9",
  "sqlacodegen~=3.2",
]
integration = [
    {include-group = "dev"},
    "httpx~=0.27",
    "marshmallow<4",
]

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

[tool.hatchling.build.targets.wheel]
packages = ["abacus_models"]
# Note: .pyi stub files and py.typed are automatically included by hatchling

# Explicitly include package data files for PEP 561 compliance
[tool.hatchling.build]
include = [
  "abacus_models/**/*.py",
  "abacus_models/**/*.pyi",
  "abacus_models/py.typed",
]

# --- Coverage ---

[tool.coverage.run]
omit = [
  "tests/*",
  "abacus_models/mysql/*",
  "abacus_models/snowflake/*",
]

# --- Mypy ---

[tool.mypy]
python_version = "3.10"
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = false
ignore_missing_imports = true

# Ignore generated model files (they're auto-generated and massive)
# Even with .pyi stubs, the generated .py files may have type inconsistencies
[[tool.mypy.overrides]]
module = [
  "abacus_models.mysql.*",
  "abacus_models.snowflake.*",
]
ignore_errors = true

# --- Pytest ---

[tool.pytest.ini_options]
testpaths = ["tests"]
norecursedirs = ["env/*"]

# --- Ruff ---

[tool.ruff]
indent-width = 4
line-length = 88
exclude = ["tests/integration/env/*"]

[tool.ruff.lint]
select = [
  # builtins
  "A",
  # isort
  "I",
  # pycodestyle
  "E",
  "W",
  # pydocstyle
  "D",
  # quotes
  "Q"
]

ignore = [
  # builtin-module-shadowing (from flake8)
  "A005",
  # missing-docstring-in-public-class
  "D101",
  # incorrect-blank-line-before-class, conflicts with D211
  "D203",
  # multi-line-summary-second-line, conflicts with D212
  "D213",
  # first-line-should-end-with-a-period (from flake8)
  "D400",
  # missing-blank-line-after-last-section (from flake8)
  "D413",
  # line-too-long, the formatter makes a best-effort at wrapping lines
  "E501",
]

[tool.ruff.format]
quote-style = "single"

[tool.ruff.lint.flake8-quotes]
inline-quotes = "single"

[tool.ruff.lint.isort]
combine-as-imports = true
forced-separate = ["tests"]
known-first-party = ["abacus_models", "tests"]
section-order = [
    "future", 
    "standard-library", 
    "third-party",
    "first-party", 
    "local-folder"
]

# --- sqlacodegen ---

[project.entry-points."sqlacodegen.generators"]
abacus = "generator:AbacusGenerator"

# --- uv ---

[[tool.uv.index]]
name = "the-orchard-registry"
url = "https://pypi.theorchard.io/pypi/"
