Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
150 lines (131 loc) · 5.24 KB
/
Copy pathpyproject.toml
File metadata and controls
150 lines (131 loc) · 5.24 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
[build-system]
requires = ["setuptools>=84.2.1", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "ethlib"
version = "0.3.0"
description = "Formally verified Ethereum primitives, written in Lean"
readme = { file = "README.md", content-type = "text/markdown" }
license = "CC0-1.0 AND MIT AND Apache-2.0 AND Unicode-3.0"
license-files = ["LICENSE", "EthLib/Base/Unicode/LICENSE"]
requires-python = ">=3.10"
authors = [{ name = "ethereum" }]
urls = { homepage = "https://github.com/ethereum/ethlib" }
[project.optional-dependencies]
test = [
"pytest==9.2.0",
"pytest-xdist==3.8.0",
"ruamel.yaml==0.19.1",
"py_ecc==8.0.0",
# The suites read TOML, and tomllib is in the standard library from Python 3.11.
"tomli==2.5.0; python_version < '3.11'",
"hypothesis==6.168.5",
]
[dependency-groups]
lint = [
"codespell==2.4.3",
"ruff==0.17.4",
"ty==0.0.99",
]
[tool.uv]
# Rebuild the native extension only when its source or build inputs change.
cache-keys = [
{ file = "pyproject.toml" },
{ file = "setup.py" },
{ file = "README.md" },
{ file = "MANIFEST.in" },
{ file = "lean-toolchain" },
{ file = "lakefile.lean" },
{ file = "lake-manifest.json" },
{ file = "EthLib.lean" },
{ file = "EthLib/**/*.lean" },
{ file = "bindings/python/**/*.c" },
{ file = "bindings/python/**/*.h" },
{ file = "bindings/python/**/*.py" },
]
[tool.pytest.ini_options]
testpaths = ["bindings/python/tests"]
pythonpath = ["bindings/python/tests"]
# importlib import mode keeps the per-suite fixtures.py files from
# clashing in sys.modules during collection.
addopts = "--import-mode=importlib"
markers = [
"archive(name, *paths): reads the paths of a release archive of tests/sources.toml; skipped unless ETHLIB_ARCHIVES names a cache directory",
]
[tool.ruff]
line-length = 100
# The modules of these directories are first-party, as for the type checker.
src = ["bindings/python", "bindings/python/tests", "scripts"]
# The scripts run on Python 3.12. The package supports Python 3.10, and the test of each wheel
# runs the suites, the vector check and the archive fetcher on the Python of the wheel.
target-version = "py312"
# `lake exe gen-bindings` writes the stub and the type aliases.
# Its check compares them byte for byte.
# tests/consensus/pq_keys/SHA256SUMS pins the key generator by its digest.
extend-exclude = [
"bindings/python/ethlib/cryptography/_native.pyi",
"bindings/python/ethlib/networking/noise/_types.py",
"tests/consensus/pq_keys/generate.py",
"tests/consensus/large_amounts/generator/",
]
[tool.ruff.per-file-target-version]
"bindings/python/ethlib/**" = "py310"
"setup.py" = "py310"
"bindings/python/tests/**" = "py310"
"tests/**" = "py310"
"scripts/fetch_archives.py" = "py310"
[tool.ruff.format]
docstring-code-format = true
[tool.ruff.lint]
# D213 is selected by exact code: the google convention would otherwise disable it.
select = ["E", "F", "B", "W", "I", "A", "N", "D", "D213", "C", "TID", "UP"]
ignore = ["D205", "D203", "D212", "D415", "C901", "A005", "C420"]
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.lint.flake8-tidy-imports]
ban-relative-imports = "all"
[tool.ruff.lint.isort]
combine-as-imports = true
known-first-party = ["ethlib"]
# The key generator imports ssz-specs, whose name a suite shares.
known-third-party = ["ssz"]
[tool.ruff.lint.per-file-ignores]
# Each suite imports its own `fixtures` module, which shares its name with the other suites',
# so a suite reaches it by a relative import.
"bindings/python/tests/**" = ["D", "TID252"]
"scripts/test_*.py" = ["D"]
"tests/**" = ["D"]
# The evaluator dispatches on the name of each `ast` node class.
"bindings/python/tests/precompile/extract_alt_bn128_cases.py" = ["N802"]
# This fork's embedded tools are terse scripts: generators of Lean code and counters of traces.
# They keep their short names, long template lines and printf formatting, and have no docstrings.
# What a generator writes is Lean code, which the build and the kernel check.
"embedded/**" = [
"C405", "D100", "D103", "E402", "E501", "E731", "E741", "N816", "UP031",
]
[tool.codespell]
# Names in the code: a re-encoding, plural data, a serializer, a truncated status, a regex,
# "Caf" before the escaped byte of "Café", and "toI", a Lean name that a generator of this fork writes.
ignore-words-list = "caf,datas,ommit,reencode,ser,statu,toi"
[tool.ty.environment]
python-version = "3.12"
# The package, and the directories whose modules the suites, the scripts and the Keccak generators import by bare name.
root = ["bindings/python", "bindings/python/tests", "scripts", "embedded/gen/keccak"]
[tool.ty.src]
# The key and SSZ limit generators import ssz-specs as `ssz`, which resolves here to the tests.
# Only their own environments install ssz-specs.
# The generator of the large-amount vectors runs inside the consensus specification.
exclude = [
".claude/",
"tests/consensus/pq_keys/generate.py",
"tests/serialization/ssz_limits/generate.py",
"tests/consensus/large_amounts/generator",
]
[tool.ty.analysis]
# setup.py runs in the build environment, which installs setuptools.
allowed-unresolved-imports = ["setuptools", "setuptools.**"]
[tool.ty.rules]
# Flag any suppression comment that no longer matches a real diagnostic.
unused-ignore-comment = "error"
[tool.ty.terminal]
error-on-warning = true