Files
David Peter c64734bcea [ty] Enable return type inference in scripts and tools (#29439)
## Summary

Enable return type inference for all 24 standalone Python scripts
checked by ty in CI, along with `py-fuzzer` and `ty_benchmark`.
2026-10-16 12:41:30 +00:00

116 lines
2.8 KiB
TOML

[project]
name = "py-fuzzer"
version = "0.0.0"
description = "Run Ruff or ty on randomly generated Python source files."
readme = "README.md"
requires-python = ">=3.12"
dependencies = [
"jinja2>=3.1.6",
"pysource-codegen>=0.6.0",
"pysource-minimize>=0.8.0",
"rich-argparse>=1.7.0",
"ruff>=0.16.8",
"termcolor>=3.1.0",
]
[project.scripts]
fuzz = "fuzz:main"
[build-system]
requires = ["flit-core>=3.12,<5"]
build-backend = "flit_core.buildapi"
[dependency-groups]
dev = ["mypy", "ruff", "ty"]
[tool.flit.module]
name = "fuzz"
[tool.mypy]
files = "fuzz.py"
pretty = true
strict = true
warn_unreachable = true
local_partial_types = true
enable_error_code = "ignore-without-code,redundant-expr,truthy-bool"
[tool.ty.analysis]
return-type-inference = "always"
[tool.ty.rules]
blanket-ignore-comment = "error"
missing-type-argument = "error"
unsound-return-statement = "error"
unsound-yield = "error"
unsupported-dynamic-base = "error"
division-by-zero = "error"
dynamic-function-decorator-return = "error"
unsound-assignment = "error"
redundant-condition-strict = "error"
disjoint-cast = "error"
missing-direct-dependency = "error"
truthiness-test-of-none-union = "error"
possibly-unresolved-reference = "error"
unused-ignore-comment = "error"
[tool.ruff]
fix = true
preview = true
[tool.ruff.format]
docstring-code-format = true
skip-magic-trailing-comma = true
[tool.ruff.lint]
select = [
"correctness",
"suspicious",
"complexity",
"performance",
"style",
"ARG",
"E",
"F",
"B",
"C4",
"SIM",
"I",
"UP",
"PGH",
"PYI",
"RUF",
]
ignore = [
# only relevant if you run a script with `python -0`,
"assert-false",
# These are enforced by, or incompatible with, the ruff formatter:
"whitespace-before-punctuation",
"line-too-long",
]
unfixable = [
"unused-variable", # ruff keeps the call, but mostly it's best to get rid of it all
"multi-value-repeated-key-literal", # automatic fix might obscure issue
"multi-value-repeated-key-variable", # automatic fix might obscure issue
"useless-expression", # automatic fix might obscure issue
"quadratic-list-summation", # Ruff's fix is faster, but I prefer using itertools.chain_from_iterable
]
[tool.ruff.lint.isort]
combine-as-imports = true
split-on-trailing-comma = false
[tool.uv]
no-build = true
require-build-hashes = true
no-binary-package = ["py-fuzzer"]
# Pin the isolated build environment for source-build exceptions.
build-constraint-dependencies = [
{ requirement = "flit-core==3.12.0", hashes = [
"sha256:18f63100d6f94385c6ed57a72073443e1a71a4acb4339491615d0f16d6ff01b2",
"sha256:e7a0304069ea895172e3c7bb703292e992c5d1555dd1233ab7b5621b5b69e62c",
] },
]
exclude-newer = "P7D"
preview-features = ["build-dependency-hashes"]