# ---- All project specifications ---- #
[project]
name = "torchtune"
description = "PyTorch native post-training library"
readme = "README.md"
requires-python = ">=3.9"
license = {file = "LICENSE"}
authors = [
    { name = "PyTorch Team", email = "packages@pytorch.org" },
]
keywords = ["pytorch", "post-training", "rlhf", "finetuning", "llm"]
dependencies = [
    # Stable torchdata (no nightly support)
    "torchdata",

    # Hugging Face integrations
    "datasets",
    "huggingface_hub[hf_transfer]",
    "safetensors",

    # Kaggle Integrations
    "kagglehub",

    # Tokenization
    "sentencepiece",
    "tiktoken",
    "blobfile>=2",
    "tokenizers",

    # Miscellaneous
    "numpy",
    "tqdm",
    "omegaconf",
    "psutil",

    # Multimodal
    "Pillow>=9.4.0",
    # Pin pyarrow to avoid breaking change in v21 (see #2890)
    "pyarrow<21.0.0",
]
dynamic = ["version"]

[project.urls]
GitHub = "https://github.com/pytorch/torchtune"
Documentation = "https://pytorch.org/torchtune/main/index.html"
Issues = "https://github.com/pytorch/torchtune/issues"

[project.scripts]
tune = "torchtune._cli.tune:main"

[project.optional-dependencies]
dev = [
    "bitsandbytes>=0.43.0",
    "comet_ml>=3.44.2",
    "mlflow",
    "pre-commit",
    "pytest==7.4.0",
    "pytest-cov",
    "pytest-mock",
    "pytest-integration",
    "tensorboard",
    # Pin urllib3 to avoid transient error from https://github.com/psf/requests/issues/6443
    "urllib3<2.0.0",
    "wandb",
    "expecttest",
]
async_rl = [
    # We will update this to a stable release soon!
    "torchrl @ git+https://github.com/pytorch/rl@0475cbf64de0cdf5f185a77badaa6eb241c63b0b",

    # We will update this to a stable release soon!
    "tensordict @ git+https://github.com/pytorch/tensordict@c61d045aaadf6c0625706a3670fc6a741f31f1b0",

    # Regular PyPI dependencies
    "ray",
    "readerwriterlock",
    "vllm==0.8.4",
    "wandb",

    # For working w/ math datasets in default config
    "math-verify[antlr4_9_3]",
]

[tool.setuptools.dynamic]
version = {attr = "torchtune.__version__"}


# ---- Explicit project build information ---- #
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"

[tool.setuptools.packages.find]
where = [""]
include = ["torchtune*", "recipes*"]

[tool.setuptools.package-data]
recipes = ["configs/*.yaml", "configs/*/*.yaml", "configs/*/*/*.yaml"]


# ---- Tooling specifications ---- #
[tool.usort]
first_party_detection = false

[tool.black]
target-version = ["py38"]

[tool.pydoclint]
style = 'google'
check-return-types = 'False'
exclude = 'tests/torchtune/models/(\w+)/scripts/|recipes/|torchtune/modules/_export'

[tool.pytest.ini_options]
addopts = ["--showlocals", "--import-mode=prepend", "--without-integration", "--without-slow-integration"]
# --showlocals will show local variables in tracebacks
# --import-mode=prepend will add the root (the parent dir of torchtune/, tests/, recipes/)
# to `sys.path` when invoking pytest, allowing us to treat `tests` as a package within the tests.
# --without-integration and --without-slow-integration: default to running unit tests only

[tool.ruff.lint]
select = ["UP006"]
