-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpyproject.toml
More file actions
141 lines (128 loc) · 5.25 KB
/
Copy pathpyproject.toml
File metadata and controls
141 lines (128 loc) · 5.25 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
[build-system]
requires = ["hatchling>=1.27"]
build-backend = "hatchling.build"
[project]
name = "openrouter-agent-sdk"
# Tracks the ported @openrouter/agent version, so a given release of this package
# says plainly which upstream version it is a port of. The verifier enforces the
# match against upstream's package.json during a sync. See the Package Version
# section of .upstreamer/upstreamer.md.
version = "0.8.0"
description = "Python port of @openrouter/agent: OpenRouter tool orchestration, streaming, state, and format compatibility."
readme = "README.md"
requires-python = ">=3.10"
license = "Apache-2.0"
authors = [{ name = "OpenRouter" }]
keywords = ["openrouter", "agent", "python", "tools", "streaming", "llm"]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Software Development :: Libraries :: Python Modules",
"Typing :: Typed",
]
dependencies = [
# The generated OpenRouter Python SDK. This package does not reimplement HTTP,
# auth, retries, or model schemas — see the substrate pin in
# .upstreamer/upstreamer.md. Upper bound because a 2.x could move the
# Responses API surface this port binds to.
"openrouter>=1.1,<2",
"pydantic>=2.11.2",
]
[project.urls]
Homepage = "https://github.com/OpenRouterTeam/python-agent"
Repository = "https://github.com/OpenRouterTeam/python-agent"
Issues = "https://github.com/OpenRouterTeam/python-agent/issues"
Changelog = "https://github.com/OpenRouterTeam/python-agent/blob/main/upstreamer-changelog.md"
"Upstream (TypeScript)" = "https://github.com/OpenRouterTeam/typescript-agent"
[project.optional-dependencies]
dev = [
"mypy>=1.10,<2.0",
"pytest>=8.4,<9.0",
"pytest-asyncio>=0.23,<1.0",
"pytest-cov>=5.0,<8.0",
"ruff>=0.14",
]
[tool.hatch.build.targets.wheel]
packages = ["src/openrouter_agent"]
# The sdist otherwise carries the whole porting apparatus (.upstreamer/,
# .github/, opencode.json, scripts/upstream). None of it is useful to a
# consumer building from source, and shipping the contract and eval prompts in a
# published artifact invites confusion about what the package *is*. Keep the
# source, tests, and license so the sdist stays buildable and auditable.
[tool.hatch.build.targets.sdist]
include = [
"src/openrouter_agent",
"tests",
"README.md",
"PORTING.md",
"LICENSE",
"pyproject.toml",
"upstreamer-changelog.md",
]
[tool.ruff]
line-length = 120
target-version = "py310"
# tmp/ is the port pipeline's scratch space (upstream checkout, probe scripts a
# sync run writes while exploring). It is gitignored, but ruff still walks it, so
# a stray scratch file there fails the verifier on grounds unrelated to the port.
# Ruff honors .gitignore for untracked files but not for an explicitly-walked
# directory, so exclude it outright.
extend-exclude = ["tmp"]
[tool.ruff.lint]
select = ["E", "F", "I", "UP", "B"]
ignore = ["B008", "B009", "B010", "B023", "B904", "E501", "I001", "UP006", "UP007", "UP035", "UP037", "UP045"]
[tool.pytest.ini_options]
asyncio_mode = "auto"
testpaths = ["tests"]
# Coverage is deliberately NOT in addopts: it would also apply to
# `pytest tests/e2e`, where a src-wide floor is meaningless and would fail the
# e2e job. The floor is passed explicitly by the unit-test CI step.
addopts = ["--strict-markers", "--strict-config", "-ra"]
filterwarnings = [
"default",
"error::DeprecationWarning",
# The generated `openrouter` SDK leaves event loops and httpx sockets
# unclosed at interpreter teardown. A blanket `error` turns that SDK-side
# cleanup into a suite failure that says nothing about this package.
"default::ResourceWarning",
]
[tool.coverage.run]
# Match the measured floor: statement coverage, no branch coverage.
source = ["openrouter_agent"]
[tool.coverage.report]
show_missing = true
exclude_also = ["if TYPE_CHECKING:", "raise NotImplementedError", "@overload"]
# Modules ported for 1:1 parity with upstream that this port does not route
# through (it inlines their logic). They are kept so the next sync has a stable
# target — see the docstring in each. Excluded so they do not dilute the floor.
omit = [
"*/openrouter_agent/stream_type_guards.py",
"*/openrouter_agent/tool_orchestrator.py",
"*/openrouter_agent/api_shape_helpers/claude_message.py",
]
[tool.mypy]
python_version = "3.10"
check_untyped_defs = true
warn_unused_ignores = false
allow_redefinition = true
explicit_package_bases = true
mypy_path = "src"
[[tool.mypy.overrides]]
module = ["anyio.*"]
follow_imports = "skip"
[[tool.mypy.overrides]]
module = ["tests.*"]
# `tool()` in the ported source returns Dict[str, Any] rather than a
# ClientTool/ServerTool union, so every tests-side call site trips list-item /
# arg-type. Fixing tool.py is the real answer, but it is ported source the next
# sync regenerates — suppress narrowly here instead of contorting the tests.
disable_error_code = ["list-item", "arg-type"]