-
Notifications
You must be signed in to change notification settings - Fork 16
/
pyproject.toml
309 lines (283 loc) · 9.47 KB
/
pyproject.toml
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
[tool.poetry]
name = "puyapy"
version = "4.0.0"
description = "An optimising compiler for Algorand Python"
authors = ["Algorand Foundation <[email protected]>"]
readme = "README.md"
packages = [
{ include = "puya", from = "src" },
{ include = "puyapy", from = "src" },
# copy stubs into published artifacts without the -stubs suffix
# if poetry adds support for includes with a "to" like parameter, that might be a better solution
# but in the mean-time this will suffice
{ include = "*", from = "stubs/algopy-stubs", to = "puyapy/_typeshed/stdlib/algopy" }
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Topic :: Software Development :: Compilers",
]
license = "AGPL-3.0-or-later"
[tool.poetry.dependencies]
python = "^3.12"
typing-extensions = "^4.11.0"
attrs = "^24.2.0"
structlog = "^24.1.0"
docstring-parser = ">=0.14.1"
pycryptodomex = ">=3.6.0,<4"
immutabledict = "^4.2.0"
packaging = "^24.0"
colorama = { version = "^0.4.6", markers = "sys_platform == 'win32'" }
mypy_extensions = "^1.0.0" # vendored mypy dependency
cattrs = "^24.1"
[tool.poetry.group.dev.dependencies]
# include stubs distribution package as a dev dependency
algorand-python = { path="stubs", develop=true }
mypy = "1.13.0"
ruff = "^0.7.4"
pre-commit = "^4.0.1"
poethepoet = "^0.30.0"
[tool.poetry.group.testing.dependencies]
pytest = "^7.4.0"
pytest-xdist = {extras = ["psutil"], version = "^3.3.1"}
py-algorand-sdk = "^2.4.0"
algokit-utils = "^2.2.1"
pytest-cov = "^4.1.0"
prettytable = "^3.9.0"
[tool.poetry.group.doc]
optional = true
[tool.poetry.group.doc.dependencies]
sphinx = "^7.2.6"
furo = "^2024.1.29"
myst-parser = "^2.0.0"
sphinx-autodoc2 = "^0.5.0"
sphinx-copybutton = "^0.5.2"
[tool.poetry.group.cicd]
optional = true
[tool.poetry.group.cicd.dependencies]
python-semantic-release = "^9.5.0"
algokit = { version="*", python=">=3.12,<3.13" }
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
[tool.poetry.scripts]
puya = "puya.__main__:cli"
puyapy = "puyapy.__main__:main"
puyapy-clientgen = "puyapy.client_gen:main"
[tool.pytest.ini_options]
markers = [
"localnet: test requires `algokit localnet start`",
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
]
addopts = "-n auto --cov-config=.coveragerc"
testpaths = [
"tests"
]
filterwarnings = [
# treat all warnings as errors by default
"error",
# ignore warnings from docstring_parser dependency, re-evaluate when changing python version or if docstring_parser is updated
"ignore:ast.NameConstant is deprecated and will be removed in Python 3.14; use ast.Constant instead",
"ignore:ast.Num is deprecated and will be removed in Python 3.14; use ast.Constant instead",
"ignore:ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead",
# ignore pytest-xdist warning
"ignore:The --rsyncdir command line argument and rsyncdirs config variable are deprecated."
]
xfail_strict = true
pythonpath = [
"src/puyapy/_vendor",
]
[tool.mypy]
python_version = "3.12"
strict = true
untyped_calls_exclude = [
"algosdk",
]
exclude = [
"src/puyapy/_typeshed",
"src/puyapy/_vendor",
"stubs/algopy\\.py",
]
[[tool.mypy.overrides]]
module = ["algopy", "algopy.*"]
disallow_any_unimported = true
disallow_any_expr = true
disallow_any_decorated = true
disallow_any_explicit = true
[[tool.mypy.overrides]]
module = ["algosdk", "algosdk.*"]
disallow_untyped_calls = false
[tool.ruff]
target-version = "py312"
line-length = 99
extend-exclude = [
"src/puyapy/_typeshed",
"src/puyapy/_vendor",
"test_cases/constants/non_utf8.py", # E902 ruff doesn't read this file encoding
]
# force-exclude ensures these files are excluded even when run via pre-commit
force-exclude = true
[tool.ruff.lint]
select = [
# all possible codes as of this ruff version are listed here,
# ones we don't want/need are commented out to make it clear
# which have been omitted on purpose vs which ones get added
# in new ruff releases and should be considered for enabling
"F", # pyflakes
"E", "W", # pycodestyle
"C90", # mccabe
"I", # isort
"N", # PEP8 naming
# "D", # pydocstyle
"UP", # pyupgrade
"YTT", # flake8-2020
"ANN", # flake8-annotations
"ASYNC", # flake8-async
"S", # flake8-bandit
# "BLE", # flake8-blind-except
"FBT", # flake8-boolean-trap
"B", # flake8-bugbear
"A", # flake8-builtins
# "COM", # flake8-commas
"C4", # flake8-comprehensions
"DTZ", # flake8-datetimez
"T10", # flake8-debugger
# "EM", # flake8-errmsg
"EXE", # flake8-executable
"FA", # flake8-future-annotations
"ISC", # flake8-implicit-str-concat
"ICN", # flake8-import-conventions
# "G", # flake8-logging-format
"INP", # flake8-no-pep420
"PIE", # flake8-pie
"T20", # flake8-print
"PYI", # flake8-pyi
"PT", # flake8-pytest-style
"Q", # flake8-quotes
"RSE", # flake8-raise
"RET", # flake8-return
"SLF", # flake8-self
"SLOT", # flake8-slots
"SIM", # flake8-simplify
"TID", # flake8-tidy-imports
"TCH", # flake8-type-checking
"INT", # flake8-gettext
"ARG", # flake8-unused-arguments
"PTH", # flake8-use-pathlib
# "TD", # flake8-todos
# "FIX", # flake8-fixme
# "ERA", # eradicate
"PGH", # pygrep-hooks
"PL", # pylint
"TRY", # tryceratops
# "FLY", # flynt
"PERF", # Perflint
"LOG", # flake8-logging
"RUF", # Ruff-specific rules
# below are for packages we're not using
# "TRIO", # flake8-trio
# "DJ", # flake8-django
# "AIR", # Airflow
# "PD", # pandas-vet
# "NPY", # NumPy-specific rules
]
ignore = [
"ISC001", # ruff-format conflict
"ANN101", # no type for self
"ANN102", # no type for cls
"SIM108", # allow if-else in place of ternary
"PLR2004", # magic values... can't configure to ignore simple low value ints like 2
"PLW2901", # allow updating loop value...
"PYI025", # I can tell the difference between set and Set thank you very much
"UP040", # TypeAlias -> type keyword, waiting for mypy support
"TRY003", # allow long exception messages in Exception constructor
"RET503", # false negatives when involving typing.Never, covered by mypy anyway
"RET504", "RET505", # stylistic choices for readability
"S101", # allow asserts
"TCH001", "TCH002", "TCH003", # don't require things to be in a type checking block
# TODO: REMOVE ALL THE BELOW AFTER REFACTORING BUILDING CODE vvv
"C901", # is too complex (> 10)
"PLR0911", # Too many return statements (> 6)
"PLR0912", # Too many branches (> 12)
"PLR0913", # Too many arguments to function call (> 5)
"PLR0915", # Too many statements (> 50)
]
unfixable = [
"F841", # don't delete unused local variables automatically
]
[tool.ruff.lint.per-file-ignores]
"stubs/algopy.py" = [
"INP001"
]
"src/**" = [
"PT", # no pytest rules
]
"**/*.pyi" = [
"SLOT"
]
"src/puyapy/awst_build/eb/**" = [
"ARG002", # TODO: remove this by either figuring out how to make it respect abstract methods
# or manually adding @typing.override everywhere 🥲
]
"src/puya/lib_embedded/**" = [
"INP", # allow missing __init__.py
]
"stubs/algopy-stubs/**" = [
"PYI021", # allow docstrings in stubs
"PYI053", # allow "docstrings" in overloads
]
"scripts/**" = [
"S",
"PT", # no pytest rules
"T201", # allow prints
"TRY002", # allow raising builtin exceptions
]
"tests/**" = [
"S",
]
"{examples,test_cases}/**" = [
"PT", # no pytest rules
"B011", # allow assert False, "msg"
"FBT001", # allow positional definitions
"FBT003", # allow positional booleans
"INP", # allow missing __init__.py
]
[tool.ruff.lint.flake8-annotations]
allow-star-arg-any = true
suppress-none-returning = true
mypy-init-return = true
[tool.ruff.lint.flake8-comprehensions]
allow-dict-calls-with-keyword-arguments = true
[tool.ruff.lint.isort]
combine-as-imports = true
force-wrap-aliases = true
[tool.ruff.lint.flake8-builtins]
builtins-ignorelist = ["id"]
[tool.semantic_release]
version_toml = ["pyproject.toml:tool.poetry.version"]
commit_message = "{version}\n\nAutomatically generated by python-semantic-release"
tag_format = "v{version}"
[tool.semantic_release.branches.main]
match = "main"
prerelease = false
[tool.semantic_release.branches.alpha]
match = ".*"
prerelease_token = "alpha"
prerelease = true
[tool.semantic_release.commit_parser_options]
allowed_tags = ["build", "chore", "ci", "docs", "feat", "fix", "perf", "style", "refactor", "test"]
minor_tags = ["feat"]
patch_tags = ["fix", "perf", "docs"]
[tool.semantic_release.publish]
dist_glob_patterns = ["dist/*", "stubs/dist/*"] # order here is important to ensure compiler wheel is published first
upload_to_vcs_release = true
[tool.semantic_release.remote.token]
env = "GITHUB_TOKEN"
[tool.poe.tasks]
docs = "poetry run python -X utf8 -m scripts.generate_docs"
gen_lang_spec = "poetry run scripts/transform_lang_spec.py"
gen_stubs = "poetry run python -m scripts.generate_stubs"
gen_avm_ops = "poetry run python -m scripts.generate_avm_ops"
gen_assemble_ops = "poetry run python -m scripts.generate_assemble_op_spec"
gen_puya_lib = "poetry run scripts/generate_puya_lib.py"
gen = ["gen_lang_spec", "gen_stubs", "gen_avm_ops", "gen_assemble_ops", "gen_puya_lib"]