# -------------------------------
# build-system
# -------------------------------
[build-system]
requires = [
    "setuptools>=61.0",
    "wheel"
]
build-backend = "setuptools.build_meta"

# -------------------------------
# project (PEP 621 metadata)
# -------------------------------
[project]
name = "TransferQueue"

dynamic = ["version", "dependencies"]
authors = [
  {name = "The TransferQueue Team", email = "hanzy19@tsinghua.org.cn"},
]

description = "TransferQueue: An Asynchronous Streaming Data Management Module"
license = {text = "Apache-2.0"}
readme = {file = "README.md", content-type = "text/markdown"}
requires-python = ">=3.10"

# -------------------------------
# tool.ruff - Linting configuration
# -------------------------------
[tool.ruff]
# Note: While the formatter will attempt to format lines such that they remain within the line-length,
# it isn't a hard upper bound, and formatted lines may exceed the line-length.
line-length = 120
target-version = "py310"

[tool.ruff.lint]
isort = {known-first-party = ["transfer_queue"]}
# c.f. https://github.com/vllm-project/vllm/blob/ce8d6b75fc0586045df75ee1568a5b5f9957251b/pyproject.toml
select = [
    # pycodestyle
    "E",
    # Pyflakes
    "F",
    # pyupgrade
    "UP",
    # flake8-bugbear
    "B",
    # isort
    "I",
    "G",
]
ignore = [
    # star imports
    "F405", "F403",
    # lambda expression assignment
    "E731",
    # Loop control variable not used within loop body
    "B007",
    # f-string format
    "UP032",
    # `.log()` statement uses f-string
    "G004",
    # X | None for type annotations
    # "UP045",
    # deprecated import
    "UP035",
]

# -------------------------------
# tool.mypy - typechecking config
# -------------------------------
[tool.mypy]
pretty            = true
ignore_missing_imports = true
explicit_package_bases = true
follow_imports = "skip"

# Blanket silence
ignore_errors = true

# -------------------------------
# tool.pytest - pytest config
# -------------------------------
[tool.pytest.ini_options]
filterwarnings = [
    "ignore:.*PyTorch API of nested tensors.*prototype.*:UserWarning",
]

[[tool.mypy.overrides]]
module = [
    "transfer_queue.*",
]
ignore_errors = false

# -------------------------------
# tool.setuptools - Additional config
# -------------------------------
[tool.setuptools]
# True means `setuptools` will attempt to include all relevant files in package_data automatically.
# This corresponds to `include_package_data=True` in setup.py.
include-package-data = true

# We read the version from a file in 'transfer_queue/version/version'
[tool.setuptools.dynamic]
version = {file = "transfer_queue/version/version"}
dependencies = {file = "requirements.txt"}

[project.optional-dependencies]
build = [
    "build"
]
test = [
    "pytest>=7.0.0",
    "pytest-asyncio>=0.20.0",
    "flake8",
    "pytest-mock",
]
yuanrong = [
    "openyuanrong-datasystem"
]
mooncake = [
    "mooncake-transfer-engine==0.3.10.post2"
]

# If you need to mimic `package_dir={'': '.'}`:
[tool.setuptools.package-dir]
"" = "."

# If you need to include specific non-Python data (like YAML files or version file):
# This is the rough equivalent of package_data={'': ['version/*']}
[tool.setuptools.package-data]
transfer_queue = [
    "version/*",
    "*.yaml"
]