-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
211 lines (194 loc) · 6.73 KB
/
pyproject.toml
File metadata and controls
211 lines (194 loc) · 6.73 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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
[build-system]
requires = ["hatchling>=1.25"]
build-backend = "hatchling.build"
[project]
name = "kashdao-protocol-sdk"
description = "Official non-custodial Python SDK for the Kash prediction-market protocol. Dual-mode: vanilla EIP-1559 from a plain EOA (canonical Hummingbot path) or ERC-4337 v0.7 via SimpleAccount + bundler. Mirrors @kashdao/protocol-sdk (TypeScript)."
readme = "README.md"
license = { file = "LICENSE" }
requires-python = ">=3.10"
authors = [{ name = "KashDAO", email = "engineering@kash.bot" }]
keywords = [
"kash",
"kashdao",
"prediction-markets",
"amm",
"ethereum",
"base",
"eip-1559",
"erc-4337",
"smart-account",
"eoa",
"hummingbot",
"market-making",
"defi",
]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: Financial and Insurance Industry",
"License :: OSI Approved :: MIT 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",
"Topic :: Office/Business :: Financial",
"Topic :: Software Development :: Libraries :: Python Modules",
"Typing :: Typed",
]
dynamic = ["version"]
dependencies = [
"web3>=6.20,<8",
"eth-account>=0.13,<1",
"eth-abi>=5.1,<6",
"eth-utils>=4.1,<6",
"eth-typing>=4.4,<6",
"httpx>=0.27,<1",
"pydantic>=2.7,<3",
"websockets>=12,<15",
"typing-extensions>=4.12; python_version<'3.12'",
]
[project.optional-dependencies]
dev = [
"pytest>=8.3",
"pytest-asyncio>=0.24",
"pytest-httpx>=0.32",
"pytest-cov>=5.0",
"ruff>=0.7",
"mypy>=1.13",
"types-requests>=2.32",
# SBOM (CycloneDX) for parity with the TS SDKs' `pnpm sbom` step.
# `cyclonedx-bom` ships the `cyclonedx-py` CLI which generates a
# CycloneDX 1.6 SBOM from the wheel's installed dependency tree.
# Attached to the GitHub Release as a release asset for enterprise
# consumers running supply-chain audits.
"cyclonedx-bom>=4.5",
]
[project.urls]
Homepage = "https://github.com/KashDAO/protocol-sdk-python"
Documentation = "https://github.com/KashDAO/protocol-sdk-python#readme"
Repository = "https://github.com/KashDAO/protocol-sdk-python.git"
Issues = "https://github.com/KashDAO/protocol-sdk-python/issues"
Changelog = "https://github.com/KashDAO/protocol-sdk-python/blob/main/CHANGELOG.md"
[tool.hatch.version]
path = "kashdao_protocol_sdk/_version.py"
[tool.hatch.build.targets.wheel]
packages = ["kashdao_protocol_sdk"]
[tool.hatch.build.targets.wheel.shared-data]
"kashdao_protocol_sdk/py.typed" = "kashdao_protocol_sdk/py.typed"
# Vendored ABI JSON files ship inside the wheel and are loaded via
# importlib.resources at runtime. Hatchling auto-includes them as
# package data because they live under the package tree
# (`kashdao_protocol_sdk/shared/contracts/generated/*.json`); no
# explicit force-include is needed (and adding one duplicates them
# in the zip).
[tool.hatch.build.targets.sdist]
include = [
"/kashdao_protocol_sdk",
"/tests",
"/examples",
"/README.md",
"/CHANGELOG.md",
"/CONTRIBUTING.md",
"/SECURITY.md",
"/RELEASING.md",
"/LICENSE",
"/HUMMINGBOT_INTEGRATION.md",
"/pyproject.toml",
]
[tool.ruff]
line-length = 100
target-version = "py310"
extend-exclude = ["kashdao_protocol_sdk/shared/contracts/generated"]
[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"I", # isort
"B", # flake8-bugbear
"UP", # pyupgrade
"ASYNC", # flake8-async
"RUF", # ruff-specific
]
ignore = [
"E501", # line length handled by formatter
"RUF022", # __all__ ordering — barrel files mirror import-section grouping rather than alpha
]
[tool.ruff.lint.isort]
known-first-party = ["kashdao_protocol_sdk"]
[tool.mypy]
python_version = "3.10"
strict = true
warn_unused_ignores = true
warn_redundant_casts = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
no_implicit_optional = true
# Examples and tests live under sibling-named directories
# (e.g. ``examples/eoa/quote_and_buy.py`` and
# ``examples/smart_account/quote_and_buy.py``) — without explicit
# package bases, mypy errors on the duplicate top-level module name.
explicit_package_bases = true
plugins = ["pydantic.mypy"]
exclude = ["^scripts/", "^kashdao_protocol_sdk/shared/contracts/generated/"]
[[tool.mypy.overrides]]
module = ["eth_abi.*", "eth_account.*", "eth_utils.*", "websockets.*", "rlp.*"]
ignore_missing_imports = true
disable_error_code = ["attr-defined"]
# web3.py 7's AsyncWeb3 is generic but the API surface we use is
# fully compatible with the unparameterized form. Suppressing the
# missing-type-args warning project-wide is cleaner than threading
# a type variable through every helper function signature, and avoids
# a lockstep dependency on the exact generic shape of web3.py.
[[tool.mypy.overrides]]
module = "kashdao_protocol_sdk.*"
disable_error_code = ["type-arg"]
[tool.pytest.ini_options]
asyncio_mode = "auto"
testpaths = ["tests"]
markers = [
"integration: end-to-end tests against Base Sepolia (requires KASH_BASE_SEPOLIA_RPC + KASH_TEST_OWNER_KEY)",
"e2e: long-running Hummingbot strategy E2E tests (skipped in PR CI)",
"parity: byte-equality parity tests against the TypeScript protocol-sdk",
]
filterwarnings = [
"error",
"ignore::DeprecationWarning:web3.*",
"ignore::DeprecationWarning:eth_utils.*",
"ignore::DeprecationWarning:websockets.*",
# web3.py 7's legacy provider triggers websockets's own deprecation
# warning at module import; out of our control.
"ignore:websockets.legacy is deprecated:DeprecationWarning",
# Python 3.12.13+ fixed cpython#118960; aiohttp now warns when web3's
# AsyncHTTPProvider sets `enable_cleanup_closed` (now a no-op). web3.py
# hasn't gated on the runtime Python version yet — until they ship,
# drop the warning so it doesn't fail tests under the strict-error
# policy. Tracks: aio-libs/aiohttp + ethereum/web3.py.
"ignore::DeprecationWarning:aiohttp.*",
"ignore:enable_cleanup_closed ignored:DeprecationWarning",
]
[tool.coverage.run]
branch = true
source = ["kashdao_protocol_sdk"]
omit = [
# Vendored ABIs — pure data, no executable code.
"kashdao_protocol_sdk/shared/contracts/generated/*",
]
[tool.coverage.report]
# Realistic enterprise threshold for a unit-test-driven coverage run.
# Chain-bound modules (markets.watch, trades.simulate, trades.submit,
# bundler RPC clients) are deliberately not unit-mocked — covering
# them via integration tests gated on `KASH_INTEGRATION=1` instead.
fail_under = 70
show_missing = true
skip_covered = false
exclude_lines = [
"pragma: no cover",
"raise NotImplementedError",
"if __name__ == .__main__.:",
"if TYPE_CHECKING:",
"@(abc\\.)?abstractmethod",
]