-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathpyproject.toml
More file actions
369 lines (342 loc) · 10.8 KB
/
pyproject.toml
File metadata and controls
369 lines (342 loc) · 10.8 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
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
[project]
name = "puyapy"
version = "5.7.1"
description = "An optimising compiler for Algorand Python"
authors = [{ name = "Algorand Foundation", email = "contact@algorand.foundation" }]
readme = "README.md"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Topic :: Software Development :: Compilers",
]
license = "AGPL-3.0-or-later"
# if updating supported Python versions, ensure puyapy/interpreter_data.py also gets updated
requires-python = ">=3.12.0,<4"
dependencies = [
"mypy==1.19.1",
"typing-extensions>=4.11.0,<5",
"attrs>=25.3.0,<26",
"structlog>=25.2.0,<26",
"docstring-parser>=0.14.1",
"pycryptodomex>=3.6.0,<4",
"immutabledict>=4.2.0,<5",
"packaging~=24.0",
"colorama>=0.4.6,<0.5 ; sys_platform == 'win32'",
"cattrs>=25.3,<26",
"networkx>=3.6,<4",
"cyclopts>=3.23.1",
"pygls>=2.0.0",
]
[dependency-groups]
dev = [
"algorand-python",
"ruff>=0.7.4,<0.8",
"pre-commit>=4.0.1,<5",
"poethepoet>=0.30.0,<0.31",
"scriv>=1.6.2,<2",
]
testing = [
"pytest>=8.0,<9",
"pytest-xdist[psutil]>=3.3.1,<4",
# TODO: bump to non alpha version
"algokit-utils>=5.0.0a12,<6",
"coverage>=7.13.4,<8",
"prettytable>=3.9.0,<4",
"pytest-asyncio>=0.26.0",
]
doc = [
"sphinx>=7.2.6,<8",
"furo>=2024.1.29,<2025",
"myst-parser>=2.0.0,<3",
"sphinx-autodoc2>=0.5.0,<0.6",
"sphinx-copybutton>=0.5.2,<0.6",
]
cicd = [
"python-semantic-release~=9.8.7",
"algokit",
"pyinstaller>=6.12.0,<7",
"pytest-split>=0.10.0,<0.11",
"junitparser>=3.2.0,<4",
]
[project.scripts]
puya = "puya.__main__:app"
puyapy = "puyapy.__main__:app"
puyapy-clientgen = "puyapy.client_gen:app"
puyapy-ls = "puyapy.lsp.__main__:app"
[tool.uv]
default-groups = [
"dev",
"testing",
"doc",
"cicd",
]
[tool.uv.sources]
# include stubs distribution package as a dev dependency
algorand-python = { path = "stubs", editable = true }
# TODO: remove once a build of algokit-cli that uses algokit utils v5 is available
algokit = { git = "https://github.com/algorandfoundation/algokit-cli", branch = "decoupling" }
[tool.hatch.build.targets.sdist]
include = [
"src/puya",
"src/puyapy",
"stubs/algopy-stubs/*",
]
[tool.hatch.build.targets.wheel]
include = [
"src/puya",
"src/puyapy",
"stubs/algopy-stubs/*",
]
[tool.hatch.build.targets.wheel.force-include]
# copy stubs into published artifacts without the -stubs suffix
"stubs/algopy-stubs" = "puyapy/_typeshed/stdlib/algopy"
[tool.hatch.build.targets.wheel.sources]
"src/puya" = "puya"
"src/puyapy" = "puyapy"
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.pytest.ini_options]
markers = [
"localnet: test requires `algokit localnet start`",
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
]
addopts = "-n auto --dist worksteal"
testpaths = [
"tests"
]
filterwarnings = [
# treat all warnings as errors by default
"error",
# ignore pytest-xdist warning
"ignore:The --rsyncdir command line argument and rsyncdirs config variable are deprecated.",
# ignore asyncio deprecation warning caused by pygls
"ignore::DeprecationWarning:pygls",
# algosdk doesn't close HTTPError objects
"ignore:Implicitly cleaning up <HTTPError:ResourceWarning",
]
xfail_strict = true
pythonpath = [
"src/puyapy/_vendor",
]
asyncio_mode = "auto" # this makes pytest_asyncio automatically handle any async test method/fixture
[tool.mypy]
python_version = "3.12"
strict = true
untyped_calls_exclude = [
"algosdk", "pygls"
]
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:project.version"]
commit_message = "{version}\n\nAutomatically generated by python-semantic-release"
tag_format = "v{version}"
[tool.semantic_release.branches.main]
match = "main"
prerelease_token = "rc"
prerelease = false
[tool.semantic_release.branches.alpha]
match = ".*"
prerelease_token = "rc"
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/*", "bdist/*"]
upload_to_vcs_release = true
[tool.semantic_release.remote.token]
env = "GITHUB_TOKEN"
[tool.poe.tasks]
docs.script = "scripts.generate_docs:main()"
gen_lang_spec.script = "scripts.transform_lang_spec:main()"
gen_stubs.script = "scripts.generate_stubs:main()"
gen_avm_ops.script = "scripts.generate_avm_ops:main()"
gen_assemble_ops.script = "scripts.generate_assemble_op_spec:main()"
gen_puya_lib.script = "scripts.generate_puya_lib:main()"
gen_stub_symtables.script = "scripts.generate_stub_symtables:main()"
gen = ["gen_lang_spec", "gen_stubs", "gen_avm_ops", "gen_assemble_ops", "gen_puya_lib", "gen_stub_symtables"]
compile_all.script = "scripts.compile_all_examples:main()"
bump_stubs.script = "scripts.bump_stubs_version:main()"
check_stubs.script = "scripts.check_stubs_version:app()"
size_diff.script = "scripts.test_cases_diff_summary:main()"
compile_all_fast.script = "scripts.compile_all_fast:main()"
lint.cmd = "pre-commit run --all-files"
update_typeshed.script = "scripts.update_typeshed:main()"
_coverage_combine.cmd = "coverage combine --quiet"
_coverage_report_term.cmd = "coverage report"
_coverage_report_xml.cmd = "coverage xml"
coverage = ["_coverage_run", "_coverage_combine", "_coverage_report_term", "_coverage_report_xml"]
[tool.poe.tasks.next_version]
cmd = "semantic-release version --print-tag"
# setting a default value for GITHUB_TOKEN allows the command to be run locally
# but in the CD pipeline it will be overridden
env.GITHUB_TOKEN.default = "na"
[tool.poe.tasks._coverage_run]
cmd = "coverage run -m pytest"
env = { COVERAGE_CORE = "sysmon" }
[tool.scriv]
version = "command: poe -q next_version"
format = "md"
md_header_level = 2
entry_title_template = "{% if version %}{{ version }}{% endif %} ({{ date.strftime('%Y-%m-%d') }})"