[build-system]
requires = ["setuptools >= 62", "versioningit ~= 3.0", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "datalab-api"
readme = "README.md"
description = "A Python API for instances of the datalab data management platform (https://github.com/the-grey-group/datalab)."
keywords = []
license = { text = "MIT" }
authors = [{ name = "Matthew Evans", email = "matthew@ml-evs.science" }]
dynamic = ["version"]
classifiers = [
    "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.9",
    "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.10",
    "Programming Language :: Python :: 3.11",
    "Programming Language :: Python :: 3.12",
    "Intended Audience :: Science/Research",
    "Intended Audience :: Information Technology",
    "Topic :: Other/Nonlisted Topic",
    "Topic :: Scientific/Engineering",
]

requires-python = ">=3.9"
dependencies =[
    "httpx ~= 0.27", # better HTTP requests
    "bokeh ~= 2.4",  # interactive plots from datalab directly
    "rich ~= 13.0",  # nicer terminal output
    "numpy < 2", # upper pin for numpy due to bad pins in bokeh
]


[project.optional-dependencies]
dev = [
    "pre-commit >= 3,< 5",
    "pytest ~= 8.0",
    "pytest-cov >= 5,< 7",
    "respx ~= 0.21",
]

docs = [
    "mkdocs",
    "mkdocs-material",
    "mkdocstrings[python-legacy]",
    "mkdocs-awesome-pages-plugin",
    "mkdocs-jupyter",
]

cli = [
    "typer ~= 0.9",   # command line interface
    "click-shell ~= 2.1", # REPL-like interface
]

cheminventory-helper = [
    "pandas ~= 2.2",
    "openpyxl ~= 3.0"
]

all = [
    "datalab-api[dev,docs,cli]"
]

[project.scripts]
datalab = "datalab_api.cli:app"

[project.urls]
homepage = "https://github.com/datalab-org/datalab-api"
repository = "https://github.com/datalab-org/datalab-api"
documentation = "https://datalab-python-api.readthedocs.io"
changelog = "https://github.com/datalab-org/datalab-api/releases"

[tool.uv]
cache-keys = [{ git = true }]

[tool.versioningit.vcs]
method = "git"
default-tag = "0.0.1"

[tool.mypy]
# plugins = "pydantic.mypy"
ignore_missing_imports = true
follow_imports = "skip"

[tool.ruff]
line-length = 100
target-version = "py39"

[tool.ruff.lint]
select = ["ALL"]
ignore = [
    "A001",
    "A002",
    "ANN",     # TODO fix all ANN errors
    "ARG",     # TODO fix unused method argument
    "B007",
    "B028",
    "B904",
    "BLE001",
    "C408",    # Unnecessary (dict/list/tuple) call - remove call
    "C416",
    "C419",
    "C901",    # function too complex
    "COM812",  # trailing comma missing
    "D",
    "D205",
    "DTZ",     # datetime-tz-now
    "E501",    # TODO fix line too long
    "EM",      # exception message must not use f-string literal
    "ERA001",  # found commented out code
    "FA100",   # TODO fix FA errors
    "FBT001",
    "FBT002",
    "FBT003",
    "FIX002",
    "G004",    # logging uses fstring
    "G201",
    "INP001",
    "ISC001",
    "N802",    # TODO maybe fix these
    "N805",
    "N818",
    "PD011",   # pandas-use-of-dot-values
    "PERF102",
    "PERF203", # try-except-in-loop
    "PERF401",
    "PGH003",
    "PGH004",
    "PLR",     # pylint-refactor
    "PLW0602",
    "PLW0603",
    "PLW2901",
    "PT003",
    "PT004",   # pytest-missing-fixture-name-underscore
    "PT006",   # pytest-parametrize-names-wrong-type
    "PT013",   # pytest-incorrect-pytest-import
    "PTH",     # prefer Pathlib to os.path
    "PYI024",
    "RET",
    "RET504",
    "RUF005",
    "RUF012",
    "RUF013",  # implicit-optional
    "RUF015",
    "S106",
    "S110",
    "S112",
    "S311",
    "S324",    # use of insecure hash function
    "S507",    # paramiko auto trust
    "S602",
    "S603",
    "S607",
    "SIM102",
    "SIM105",
    "SIM108",
    "SIM117",
    "SLF",     # private member accessed outside class
    "SLOT000",
    "T201",
    "TCH",
    "TD",      # TODOs
    "TRY",     # long message outside exception class
    "UP031",
]
pydocstyle.convention = "numpy"
isort.known-first-party = ["jobflow_remote"]
isort.split-on-trailing-comma = false
fixable = ["A", "B", "C", "D", "E", "F", "I"]
unfixable = []
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

[tool.ruff.format]
docstring-code-format = true

[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401"]
"**/tests/*" = ["INP001", "S101"]