[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"]