mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-12 23:55:08 +00:00

## Summary This PR gets rid of the `requirements.in` and `requirements.txt` files in the `scripts/fuzz-parser` directory, and replaces them with `pyproject.toml` and `uv.lock` files. The script is renamed from `fuzz-parser` to `py-fuzzer` (since it can now also be used to fuzz red-knot as well as the parser, following https://github.com/astral-sh/ruff/pull/14566), and moved from the `scripts/` directory to the `python/` directory, since it's now a (uv)-pip-installable project in its own right. I've been resisting this for a while, because conceptually this script just doesn't feel "complicated" enough to me for it to be a full-blown package. However, I think it's time to do this. Making it a proper package has several advantages: - It means we can run it from the project root using `uv run` without having to activate a virtual environment and ensure that all required dependencies are installed into that environment - Using a `pyproject.toml` file means that we can express that the project requires Python 3.12+ to run properly; this wasn't possible before - I've been running mypy on the project locally when I've been working on it or reviewing other people's PRs; now I can put the mypy config for the project in the `pyproject.toml` file ## Test Plan I manually tested that all the commands detailed in `python/py-fuzzer/README.md` work for me locally. --------- Co-authored-by: David Peter <sharkdp@users.noreply.github.com>
79 lines
1.6 KiB
TOML
79 lines
1.6 KiB
TOML
[project]
|
|
name = "py-fuzzer"
|
|
version = "0.0.0"
|
|
readme = "README.md"
|
|
requires-python = ">=3.12"
|
|
dependencies = [
|
|
"pysource-codegen>=0.6.0",
|
|
"pysource-minimize>=0.7.0",
|
|
"rich-argparse>=1.6.0",
|
|
"ruff>=0.8.0",
|
|
"termcolor>=2.5.0",
|
|
]
|
|
|
|
[project.scripts]
|
|
fuzz = "fuzz:main"
|
|
|
|
[build-system]
|
|
requires = ["hatchling"]
|
|
build-backend = "hatchling.build"
|
|
|
|
[dependency-groups]
|
|
dev = ["mypy", "ruff"]
|
|
|
|
[tool.hatch.build.targets.wheel]
|
|
include = ["fuzz.py"]
|
|
|
|
[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.ruff]
|
|
fix = true
|
|
preview = true
|
|
|
|
[tool.ruff.format]
|
|
docstring-code-format = true
|
|
skip-magic-trailing-comma = true
|
|
|
|
[tool.ruff.lint]
|
|
select = [
|
|
"ARG",
|
|
"E",
|
|
"F",
|
|
"B",
|
|
"B9",
|
|
"C4",
|
|
"SIM",
|
|
"I",
|
|
"UP",
|
|
"PIE",
|
|
"PGH",
|
|
"PYI",
|
|
"RUF",
|
|
]
|
|
ignore = [
|
|
# only relevant if you run a script with `python -0`,
|
|
"B011",
|
|
# These are enforced by, or incompatible with, the ruff formatter:
|
|
"E203",
|
|
"E501",
|
|
# Makes code slower and more verbose
|
|
# https://github.com/astral-sh/ruff/issues/7871
|
|
"UP038",
|
|
]
|
|
unfixable = [
|
|
"F841", # unused variable. ruff keeps the call, but mostly it's best to get rid of it all
|
|
"F601", # automatic fix might obscure issue
|
|
"F602", # automatic fix might obscure issue
|
|
"B018", # automatic fix might obscure issue
|
|
"RUF017", # 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
|