Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
170 lines (152 loc) · 4.8 KB
/
Copy pathpyproject.toml
File metadata and controls
170 lines (152 loc) · 4.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
[project]
name = "opencode-python-sdk"
dynamic = ["version"]
description = "Typed Python client for the OpenCode 2.x server API"
readme = "README.md"
license = "MIT"
license-files = ["LICENSE"]
requires-python = ">=3.10"
authors = [{ name = "Shrijayan Rajendran" }]
keywords = ["opencode", "ai", "agents", "coding-agent", "sdk", "client"]
classifiers = [
"Development Status :: 4 - Beta",
"Framework :: AsyncIO",
"Framework :: Pydantic :: 2",
"Framework :: Trio",
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Topic :: Software Development :: Libraries :: Python Modules",
"Typing :: Typed",
]
dependencies = [
"anyio>=4.4,<5",
"httpx>=0.27,<1",
"pydantic>=2.12,<3",
"typing-extensions>=4.12",
]
[project.urls]
Homepage = "https://github.com/shrijayan/opencode-python-sdk"
Documentation = "https://shrijayan.github.io/opencode-python-sdk/"
Repository = "https://github.com/shrijayan/opencode-python-sdk"
Issues = "https://github.com/shrijayan/opencode-python-sdk/issues"
Changelog = "https://github.com/shrijayan/opencode-python-sdk/blob/main/CHANGELOG.md"
[project.optional-dependencies]
pty = [
"websockets>=14,<17",
]
aiohttp = [
"httpx-aiohttp>=0.1.9,<0.3",
]
[dependency-groups]
dev = [
"mypy>=1.18",
"pyright>=1.1.408",
"pytest>=8.4",
"httpx-aiohttp>=0.1.9",
"pytest-cov>=7",
"respx>=0.22",
"ruff>=0.14",
"trio>=0.31",
"websockets>=14",
]
# Pillow (via [imaging]) only ships patched releases for Python 3.11+, so docs builds need 3.11+.
docs = [
"mkdocs-material[imaging]>=9.6; python_version >= '3.11'",
"mkdocstrings[python]>=0.30; python_version >= '3.11'",
"pillow>=13; python_version >= '3.11'",
]
[build-system]
requires = ["hatchling>=1.27", "hatch-vcs>=0.5"]
build-backend = "hatchling.build"
[tool.hatch.version]
# The version comes from the latest `vX.Y.Z` git tag, which the release workflow creates on every merge to main.
source = "vcs"
raw-options = { local_scheme = "no-local-version", fallback_version = "0.0.0" }
[tool.hatch.build.targets.wheel]
packages = ["src/opencode"]
[tool.hatch.build.targets.sdist]
include = ["src/opencode", "tests", "README.md", "LICENSE", "CHANGELOG.md", "api.md"]
[tool.uv]
required-version = ">=0.8"
[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = ["-ra", "--strict-markers", "--strict-config"]
xfail_strict = true
filterwarnings = ["error"]
markers = [
"live: runs against a real `opencode serve` process (needs the opencode CLI on PATH)",
]
[tool.coverage.run]
source = ["opencode"]
branch = true
[tool.coverage.report]
exclude_also = ["if TYPE_CHECKING:", "@overload", "raise NotImplementedError"]
[tool.ruff]
line-length = 120
target-version = "py310"
src = ["src", "tests", "codegen"]
[tool.ruff.lint]
select = [
"B", # bugbear
"C4", # comprehensions
"D1", # missing docstrings (public modules only; tests/test_docs_coverage.py covers the private runtime modules)
"E", # pycodestyle errors
"F", # pyflakes
"FA", # future annotations
"I", # isort
"PIE", # misc lints
"PT", # pytest style
"RUF", # ruff-specific
"SIM", # simplify
"T20", # print statements
"TC", # type-checking imports
"UP", # pyupgrade
"W", # pycodestyle warnings
]
ignore = [
"D105", # magic methods
"D107", # __init__: arguments are documented on the class
"E501", # line length is handled by the formatter
"RUF022", # __all__ keeps a readable, grouped order
]
[tool.ruff.lint.per-file-ignores]
# Generated modules import types at runtime because pydantic and the request code evaluate them.
"src/opencode/types/**" = ["E741", "TC"]
"src/opencode/resources/**" = ["TC"]
"src/opencode/_errors.py" = ["TC"]
# D1 applies to the published package only.
"codegen/**" = ["T20", "D1"]
"scripts/**" = ["T20", "D1"]
"examples/**" = ["T20", "D1"]
"tests/**" = ["E501", "TC", "D1"]
"docs/**" = ["D1"]
[tool.ruff.lint.isort]
known-first-party = ["opencode", "codegen"]
combine-as-imports = true
[tool.pyright]
include = ["src", "tests", "examples"]
pythonVersion = "3.10"
typeCheckingMode = "strict"
reportImplicitOverride = "error"
reportUnnecessaryTypeIgnoreComment = "error"
[[tool.pyright.executionEnvironments]]
root = "tests"
# respx ships without complete type information.
reportPrivateUsage = false
reportUnknownMemberType = false
reportUnknownVariableType = false
reportUnknownArgumentType = false
reportUnknownLambdaType = false
[tool.mypy]
python_version = "3.10"
strict = true
files = ["src/opencode"]
warn_unreachable = true
enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]