[project]
name = "swf-feed-ingestion"
version = "1.0.0"
description = "SWF ETL repository"
readme = "README.md"
# python version (major.minor) should match base from Dockerfile
requires-python = "==3.13.*"

# NOTE: Make sure you follow [Dependencies Management Guideline](DEPENDENCIES_MANAGEMENT.md)
# TLDR:
#  * upgrade package with `uv lock --upgrade-package <package-name>`
#  * add new using ~= caped to the latest minor version, e.g. `boto3~=1.40`
dependencies = [
    "awscli~=1.44",
    "botocore~=1.40",
    "boto3~=1.40",
    # cryptography frequently updates major version, so we use the latest
    "cryptography",
    # decorator version >=5 is incompatible
    # because it doesn't keep __code__ attr of the decorated function
    "decorator~=4.4.2",
    "httplib2~=0.31",
    "garcon_contrib~=1.3",
    "google-api-python-client~=2.108",
    "jsonschema~=4.25",
    # command is very poorly supported package. The last (and the only) release was in 2013 TODO: replace with stdlib subprocess
    "command",
    "numpy~=2.3",
    "oauth2client~=4.1",
    "oto~=1.0",
    "owsrequest~=2.10",
    "pandas~=2.3",
    "paramiko~=3.4",
    "pymysql~=1.1",
    # python-dateutil is subdependency of botocore, pandas, freezegun, moto...
    "python-dateutil~=2.9",
    "pyyaml~=6.0",
    "python-jenkins~=1.8",
    "requests~=2.33", # was ~=2.32 - bumped for SAST
    # requests-futures used only by fluentd_logging_handler.py which is not used. TODO: remove fluentd_logging_handler.py and this dependency
    "requests-futures~=1.0",
    "s3fs~=0.4",
    "sentry-sdk~=2.38",
    "smart-open~=7.3",
    "secrets-manager~=1.4",
    "snowflake_connector_etl~=1.1",
    "snowflake-connector-python~=4.4",
    "xmltodict~=1.0",
    "neo4j~=5.28",
    # kafka-python pinned to 2.0.* because 2.2.15 fails in tests
    # TypeError: OffsetAndMetadata.__new__() missing 1 required positional argument: 'leader_epoch'
    "kafka-python~=2.0.2",
    "garcon~=1.1",
    "urllib3~=2.7",
    "python-gnupg~=0.5",
    "jinja2~=3.1",
    "ddtrace~=3.17",
    "python-json-logger~=4.0",
    "jinjasql2~=0.1",
    "openpyxl~=3.1",
    "supervisor~=4.3",
]

[project.scripts]
garcon = "feed_ingestion.cli:garcon"

[dependency-groups]
# We do not pin versions of dev dependencies.
# If need to upgrade any do `uv lock --upgrade-package <package-name>`
dev = [
    "deptry",
    "flake8",
    "flake8-builtins",
    "flake8-docstrings",
    "flake8-import-order",
    "flake8-quotes",
    "freezegun",
    "httpretty",
    "moto",
    "pytest",
    "pytest-cov",
    "pytest-mock",
    "pytest-snapshot",
    "python-dotenv",
    "ruff",
]

[tool.uv]
package = false

[tool.uv.sources]
owsrequest = { index = "orchard" }
owsresponse = { index = "orchard" }
garcon_contrib = { index = "orchard" }
secrets_manager = { index = "orchard" }
snowflake_connector_etl = { index = "orchard" }

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

[tool.ruff]
line-length = 79
target-version = "py311"

[tool.ruff.lint]
select = ["D", "E", "F", "I", "Q", "W"]
ignore = ["D413", "I001"]

[tool.ruff.lint.per-file-ignores]
"tests/**/*.py" = [
  "D1",  # docstring in tests
]
"dev/**/*.py" = [
  "D1",  # docstring in dev
]

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

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

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

[tool.deptry]
exclude = [
    'dev.py',
    'setup.py',
    '.venv',
    'itms/',
    'tmp/',
    'build/',
    'local/',
]
ignore = [
    "DEP004", # imported but declared as a dev dependency
]
ignore_notebooks = true

[tool.deptry.per_rule_ignores]
# DEP001: imported but missing from the dependency definitions
DEP001 = [
    'joblib',  # optional of flow_timings.py
    '__main__', # used in exec_utils.py
]
# DEP002: imported but it is a transitive dependency
DEP002 = [
    'awscli',  # used in split_file.sh as cli
    'ddtrace',  # used in supervisor command
    'openpyxl', # used in flows/sme_latam pd.read_excel(..., engine='openpyxl')
    'supervisor', # used entrypoint.sh as cli
]
# DEP003: imported but it is a transitive dependency
DEP003 = [
]
