-
Notifications
You must be signed in to change notification settings - Fork 181
Expand file tree
/
Copy pathpyproject.toml
More file actions
311 lines (279 loc) · 10.3 KB
/
pyproject.toml
File metadata and controls
311 lines (279 loc) · 10.3 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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
# To install:
#
# poetry install -E data -E test -E docs -E hypersync -E ccxt -E cloudflare_r2 -E duckdb
#
#
[tool.poetry]
authors = ["Mikko Ohtamaa <mikko@tradingstrategy.ai>"]
description = "Integrate Web3 and DeFi protocols to Python applications"
license = "MIT"
name = "web3-ethereum-defi"
version = "1.1"
homepage = "https://web3-ethereum-defi.tradingstrategy.ai/"
keywords = [
"uniswap",
"aave",
"gmx",
"gnosis",
"ethereum",
"erc-20",
"web3",
"blockchain",
"arbitrum",
"chainlink",
"hyperliquid",
"ccxt",
"freqtrade",
]
packages = [
{include = "eth_defi"},
]
readme = "README.md"
repository = "https://github.com/tradingstrategy-ai/web3-ethereum-defi"
# See PyPi for supported links https://github.com/pypi/warehouse/blob/main/warehouse/templates/packaging/detail.html
# https://stackoverflow.com/a/74394591/315168
# https://pypi.org/project/links-demo/
[tool.poetry.urls]
Changelog = "https://github.com/tradingstrategy-ai/web3-ethereum-defi/blob/master/CHANGELOG.md"
Discord = "https://discord.gg/5M88m9nM8H"
Documentation = "https://web3-ethereum-defi.tradingstrategy.ai/"
Sponsor = "https://tradingstrategy.ai"
Twitter = "https://twitter.com/tradingprotocol"
Youtube = "https://www.youtube.com/@tradingstrategyprotocol"
[tool.poetry.dependencies]
python = ">=3.10,<4"
# https://github.com/apache/arrow/pull/35412
# Last checked 2023-07, still broken
urllib3 = ">=2"
cachetools = ">=4"
eth-bloom = "^2.0.0"
futureproof = "^0.3.1"
orjson = ">=3.10.0" # Fast JSON decoding for JSON-RPC responses
psutil = "^5.9.0"
setuptools = {version = ">=63,<=70"}
#evm-trace = "^0.2.6"
#web3 = {version = "^7.12.0", extras = ["tester"]}
sigfig = "^1.3.2"
tqdm = {version = ">=4.66.1", optional = true}
tqdm-loggable = ">=0.1.3"
# Allow Numpy 2.x now that ecosystem compatibility has improved
numpy = {version = "<3", optional = true}
# Pandas is used across core modules (timestamp cache, multicall, token reading)
pandas = {version = ">=1.4"}
# Data
ffn = {version = "^1.1.2", optional = true}
gql = {extras = ["requests"], version = "^3.3.0", optional = true}
jupyter = {version = "^1.0.0", optional = true}
kaleido = {version = "^1.0.0", optional = true}
matplotlib = {version = ">=3.5", optional = true}
plotly = {version = ">6", optional = true}
pyarrow = {version = "*", optional = true}
pytest-xdist = {version = "^3.3.1", optional = true}
tenacity = {version = "*", optional = true}# Needed for Plotly
# We are using evm-trace, so for compat
#eth-pydantic-types = {version = "^0.2.0"}
# web3-google-hsm = {git = "https://github.com/Ankvik-Tech-Labs/web3-google-hsm"}
pytz = "^2024.2"
web3-google-hsm = "^0.1.0"
# Docs
Sphinx = {version = "^4.5.0", optional = true}
furo = {version = "^2022.6.4.1", optional = true}
nbsphinx = {version = "^0.8.9", optional = true}
sphinx-autodoc-typehints = {version = "^1.16.0", optional = true}
sphinx-rtd-theme = {version = "^1.0.0", optional = true}
sphinx-sitemap = {version = "^2.2.0", optional = true}
sphinxcontrib-applehelp = {version = "1.0.4", optional = true}# Version pindowns https://github.com/sphinx-doc/sphinxcontrib-applehelp/blob/master/CHANGES
sphinxcontrib-devhelp = {version = "1.0.2", optional = true}# Version pindowns https://github.com/sphinx-doc/sphinxcontrib-devhelp/blob/master/CHANGES
sphinxcontrib-htmlhelp = {version = "2.0.1", optional = true}# Version pindowns https://github.com/sphinx-doc/sphinxcontrib-htmlhelp/blob/master/CHANGES
sphinxcontrib-qthelp = {version = "1.0.3", optional = true}# Version pindowns https://github.com/sphinx-doc/sphinxcontrib-qthelp/blob/master/CHANGES
sphinxcontrib-serializinghtml = {version = "1.1.5", optional = true}# Version pindowns https://github.com/sphinx-doc/sphinxcontrib-serializinghtml/blob/master/CHANGES
zope-dottedname = {version = "^6.0", optional = true}
# Removed
# Only soft dependency in tests, but RTD complains
# terms-of-service = {path = "contracts/terms-of-service", develop = true}
# multicall removed - replaced by internal eth_defi.event_reader.multicall_batcher
#safe-eth-py = "^7.5.1"
base58 = "^2.1.1"
joblib = "^1.4.2"
# HyperSync
# Temporary package name that publishes Python 3.14 compatible Envio HyperSync wheels
hypersync-temp = {version = "^0.10.0", optional = true}
# cherry-etl = "^0.5.1"
atomicwrites = "^1.4.1"
eth-account = "^0.13.7"
eth-pydantic-types = "^0.2.0"
eth-tester = "*"
eth-typing = "^5.2.1"
evm-trace = "^0.2.6"
filelock = "^3.20.0"
# Hyperliquid L1 action signing (phantom agent protocol) in eth_defi.hyperliquid.block
msgpack = "^1.0"
safe-eth-py = "^7.8.0"
web3 = "^7.12.0"
zstandard = "^0.25.0"
# CCXT
#
# Needed only for GMX CCXT API.
# Very large dependency.
boto3 = {version = "^1.41.0", optional = true}
ccxt = {version = "^4.5.16", optional = true}
# Timestamp cache
duckdb = {version = "^1.4.2", optional = true}
# LZ4 decompression for Hyperliquid S3 archive backfill
lz4 = {version = "^4.3.0", optional = true}
python-slugify = "^8.0.4"
requests-ratelimiter = "^0.7.0"
strictyaml = "^1.7.3"
[tool.poetry.group.dev.dependencies]
flaky = "^3.7.0"
ipdb = "^0.13.9"
pytest = "^8.2"
pytest-mock = "^3.7.0"
ruff = "^0.11.13"
# See discussion https://github.com/python-poetry/poetry/issues/3348#issuecomment-726534462
anyio = "^4.11.0"
pytest-asyncio = ">=0.25,<2"
# Logo processing dependencies for vault protocol logos
# See .claude/skills/post-process-logo/SKILL.md
google-generativeai = ">=0.8.0"
# See .claude/skills/post-process-logo/SKILL.md
cairosvg = ">=2.7.0"
# rembg and onnxruntime are needed for background removal in logo processing
onnxruntime = "^1.23.2"
rembg = ">=2.0.50"
# pillow and onnxruntime are needed for background removal in logo processing
pillow = "^12.1.0"
[tool.poetry.extras]
# To install the web3py version based dependencies
data = ["jupyter", "tqdm", "gql", "matplotlib", "plotly", "pyarrow", "numpy", "tenacity", "kaleido", "ffn"]
docs = [
"Sphinx",
"sphinx-rtd-theme",
"sphinx-sitemap",
"sphinx-autodoc-typehints",
"furo",
"nbsphinx",
"zope.dottedname",
"sphinx-sitemap",
"sphinx-rtd-theme",
]
test = ["pytest-xdist"]
ccxt = ["ccxt"]
cloudflare_r2 = ["boto3"]
duckdb = ["duckdb"]
hyperliquid_backfill = ["boto3", "lz4", "duckdb"]
hypersync = ["hypersync-temp"]
#tester = ["eth-tester"]
[build-system]
build-backend = "poetry.core.masonry.api"
requires = ["poetry-core>=1.0.0"]
[tool.pytest.ini_options]
addopts = "--capture=no --tb=native --durations=20"
# Do not let pytest to crawl into contracts/ subprojects
# that contain tests and are independent from us
# https://stackoverflow.com/a/58306308/315168
norecursedirs = "contracts/*"
# Configure pytest-asyncio mode
asyncio_mode = "auto"
filterwarnings = [
"ignore::DeprecationWarning:pkg_resources.*:",
"ignore::DeprecationWarning:eth_tester.*:",
# asyncio.iscoroutinefunction deprecated in Python 3.14, not yet fixed in
# eth-retry 0.3.7 and cached-property 2.0.1 (both at latest versions)
"ignore:'asyncio.iscoroutinefunction' is deprecated:DeprecationWarning:eth_retry.*:",
"ignore:'asyncio.iscoroutinefunction' is deprecated:DeprecationWarning:cached_property.*:",
# websockets.legacy deprecated since v14.0; web3.py still uses it and
# constrains websockets <16.0.0, so we cannot upgrade past this
"ignore::DeprecationWarning:websockets.*:",
# google-auth load_credentials_from_dict deprecation (transitive dep)
"ignore::DeprecationWarning:google.auth.*:",
# web3-google-hsm uses Pydantic V2 class-based Config; only version 0.1.0
# exists and upstream needs to migrate to ConfigDict
"ignore::DeprecationWarning:web3_google_hsm.*:",
# Unclosed sockets/databases from cffi and web3 internals during test teardown
"ignore::ResourceWarning",
]
[tool.ruff]
# We hate arbitrary line lengths
extend-exclude = ["*.ipynb"]
indent-width = 4
line-length = 999
[tool.ruff.lint]
# Enable preview features & checks (use with caution)
extend-select = [
# features in preview
"W292", # missing-newline-at-end-of-file
]
preview = true
select = [
"A", # flake8-builtins
"ARG", # flake8-unused-arguments
"B", # flake8-bugbear
"C", # mccabe
"COM", # flake8-commas (enforces trailing commas)
"DTZ", # flake8-datetimez
"E", # pycodestyle errors
"EM", # flake8-errmsg
"F", # Pyflakes
"FBT", # flake8-boolean-trap
"ICN", # flake8-import-conventions
"ISC", # flake8-implicit-str-concat
"I", # isort
"N", # pep8-naming
"PLC", # Pylint Convention
"PLE", # Pylint Error
"PLR", # Pylint Refactor
"PLW", # Pylint Warning
"Q", # flake8-quotes
"RUF", # Ruff-specific rules
"S", # flake8-bandit
"T", # flake8-debugger
"TID", # flake8-tidy-imports
"UP", # pyupgrade
"W", # pycodestyle warnings
"YTT", # flake8-2020
"RUF100", # Automatically remove unused # noqa directives,
]
ignore = [
# Allow non-abstract empty methods in abstract base classes
"B027", # Allow boolean positional values in function calls, like `dict.get(... True)`
"FBT003", # Ignore checks for possible passwords
"S105",
"S106",
"S107", # Ignore complexity
"C901",
"PLR0911",
"PLR0912",
"PLR0913",
"PLR0915",
"PLC1901", # empty string comparisons
"PLW2901", # `for` loop variable overwritten
"SIM114", # Combine `if` branches using logical `or` operator
"E203", # Whitespace before :, needed for black compatibility and also `ruff format`
"ISC001", # causes unexpected behaviour with formatter,
"COM812", # Trailing comma missing - conflicts with formatter
"S101", # Use of asserts
"EM102", # Exception must not use f-string literal
]
[tool.ruff.lint.per-file-ignores]
# CLI scripts legitimately use print() for console output
"scripts/**/*.py" = ["T201"]
[tool.ruff.lint.isort]
# Configure import sorting
known-first-party = ["eth_defi"]
[tool.ruff.lint.flake8-tidy-imports]
ban-relative-imports = "all"
[tool.ruff.format]
# Force function parameters to cascade when they don't fit on one line
# This makes ruff more aggressive about splitting long function calls/definitions
docstring-code-format = true # Format code blocks in docstrings
indent-style = "space"
skip-magic-trailing-comma = false # Respect trailing commas to force multi-line
# This disables the specific normalization rule
# skip-string-normalization = true # Available since Ruff 0.5+
# NOTE: Still under development. Ref: https://github.com/astral-sh/ruff/issues/6606
#[tool.ruff.lint.pydocstyle]
## Use Sphinx docstring convention
#convention = "sphinx"
[tool.poetry.scripts]
install-aave-for-testing = 'eth_defi.aave_v3.deployer:install_aave_for_testing'