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

[project]
name = "openhands"
version = "1.0.7"
description = "OpenHands CLI - Terminal User Interface for OpenHands AI Agent"
readme = "README.md"
license = { text = "MIT" }
authors = [ { name = "OpenHands Team", email = "contact@all-hands.dev" } ]
requires-python = ">=3.12"
classifiers = [
  "Programming Language :: Python :: 3 :: Only",
  "Programming Language :: Python :: 3.12",
  "Programming Language :: Python :: 3.13",
]
# Using Git URLs for dependencies so installs from PyPI pull from GitHub
# TODO: pin package versions once agent-sdk has published PyPI packages
dependencies = [
  "openhands-sdk==1.1",
  "openhands-tools==1.1",
  "prompt-toolkit>=3",
  "typer>=0.17.4",
]

scripts = { openhands = "openhands_cli.simple_main:main" }

[dependency-groups]
# Hatchling wheel target: include the package directory
dev = [
  "black>=23",
  "flake8>=6",
  "gevent>=24.2.1,<26",
  "isort>=5",
  "mypy>=1",
  "pre-commit>=4.3",
  "pyinstaller>=6.15",
  "pytest>=8.4.1",
  "pytest-cov>=6",
  "pytest-forked>=1.6",
  "pytest-xdist>=3.6.1",
  "ruff>=0.11.8",
]

[tool.hatch.metadata]
allow-direct-references = true

[tool.hatch.build.targets.wheel]
packages = [ "openhands_cli" ]

# uv source pins for internal packages

[tool.black]
line-length = 88
target-version = [ "py312" ]

[tool.ruff]
target-version = "py312"
line-length = 88

format.indent-style = "space"
format.quote-style = "double"
format.line-ending = "auto"
format.skip-magic-trailing-comma = false
lint.select = [
  "B",  # flake8-bugbear
  "C4", # flake8-comprehensions
  "E",  # pycodestyle errors
  "F",  # pyflakes
  "I",  # isort
  "UP", # pyupgrade
  "W",  # pycodestyle warnings
]
lint.ignore = [
  "B008", # calls in argument defaults
  "C901", # too complex
  "E501", # line too long (black handles)
]

[tool.isort]
profile = "black"
line_length = 88

[tool.coverage.run]
relative_files = true
omit = [ "tests/*", "**/test_*" ]

[tool.coverage.paths]
source = [
  "openhands_cli/",
  "openhands-cli/openhands_cli/",
]

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

# UNCOMMENT TO USE EXACT COMMIT FROM AGENT-SDK

# [tool.uv.sources]
# openhands-sdk = { git = "https://github.com/OpenHands/agent-sdk.git", subdirectory = "openhands-sdk", rev = "7b695dc519084e75c482b34473e714845d6cef92" }
# openhands-tools = { git = "https://github.com/OpenHands/agent-sdk.git", subdirectory = "openhands-tools", rev = "7b695dc519084e75c482b34473e714845d6cef92" }
