Add .ruff.toml, ty.toml, .coveragerc, .pytest.ini and .pre-commit-config.yaml, take .editorconfig, .gitignore and the CI workflow from the standard (keeping the repository's own CI steps, the byte-exact fixture attributes and the fixture ignore exceptions), and reduce pyproject.toml to metadata plus the setuptools build mapping. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B8cL4zN4XpaQF5cBtASzfq
121 lines
3.6 KiB
TOML
121 lines
3.6 KiB
TOML
# Ruff linter + formatter. https://docs.astral.sh/ruff/settings/
|
|
target-version = "py314"
|
|
line-length = 88
|
|
indent-width = 4
|
|
src = ["src", "tests"]
|
|
required-version = ">=0.14"
|
|
|
|
# Ruff already skips .git, .venv, venv, build, dist, caches, node_modules,
|
|
# site-packages, and the other usual suspects (`ruff check --show-settings`),
|
|
# and respects .gitignore. Only list what is specific to this project.
|
|
extend-exclude = [".pixi", "htmlcov"]
|
|
|
|
[lint]
|
|
preview = true
|
|
# Preview *behavior* is on, but preview-only rules must be selected by code,
|
|
# so upgrading ruff never silently turns on unstable rules.
|
|
explicit-preview-rules = true
|
|
select = [
|
|
"F", # pyflakes
|
|
"E", # pycodestyle errors
|
|
"W", # pycodestyle warnings
|
|
"I", # isort
|
|
"N", # pep8-naming
|
|
"D", # pydocstyle
|
|
"UP", # pyupgrade
|
|
"ANN", # annotations
|
|
"S", # bandit (security)
|
|
"BLE", # blind except
|
|
"FBT", # boolean traps
|
|
"B", # bugbear
|
|
"C4", # comprehensions
|
|
"DTZ", # timezone-aware datetimes
|
|
"T20", # print statements
|
|
"PT", # pytest style
|
|
"RET", # return statements
|
|
"SIM", # simplify
|
|
"TID", # tidy imports
|
|
"ARG", # unused arguments
|
|
"PTH", # prefer pathlib
|
|
"ERA", # commented-out code
|
|
"PGH", # pygrep hooks (specific noqa / type: ignore codes)
|
|
"PL", # pylint
|
|
"TRY", # tryceratops
|
|
"PERF", # performance
|
|
"LOG", # logging
|
|
"G", # logging format strings
|
|
"PIE", # misc lints
|
|
"INP", # implicit namespace packages
|
|
"RUF", # ruff-specific
|
|
]
|
|
ignore = [
|
|
"D105", # magic-method docstrings
|
|
"D107", # __init__ docstrings (documented on the class)
|
|
"PLR0911", # too many returns: decision tables read best flat
|
|
"PLR0912", # too many branches: same
|
|
"PLR0913", # too many arguments: config-driven constructors
|
|
"PLR0915", # too many statements: same
|
|
"PLR0917", # too many positional arguments
|
|
"PLR2004", # magic values: thresholds live in config
|
|
"TRY003", # long exception messages are deliberate
|
|
"ANN401", # Any is used for raw API payloads
|
|
"FBT001", # boolean positional args in small helpers
|
|
"FBT002",
|
|
]
|
|
fixable = ["ALL"]
|
|
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
|
|
|
|
[lint.per-file-ignores]
|
|
"tests/**/*.py" = [
|
|
"S101", # assert is the point of tests
|
|
"D", # test docstrings are optional
|
|
"ANN", # fixtures and tests need no annotations
|
|
"INP001", # tests are not a package
|
|
"ARG", # fixtures are often requested only for side effects
|
|
"FBT",
|
|
"PLR2004",
|
|
"PLC0415", # local imports keep heavy fixtures lazy
|
|
"S105",
|
|
"S106",
|
|
"S311", # pseudo-random data is fine in tests
|
|
"S603", # tests drive git with fixed argument lists
|
|
"S607",
|
|
"DTZ",
|
|
"E501", # dense fixtures
|
|
"PT018",
|
|
"BLE001", # deliberate fault injection
|
|
"T20",
|
|
]
|
|
"src/paperspec/cli.py" = ["T201"] # the CLI prints by design
|
|
"**/__init__.py" = ["F401"] # re-exports
|
|
"src/paperspec/cli/*.py" = ["T201"] # paperspec-specific: the commands are a package, and they print by design
|
|
|
|
[lint.pycodestyle]
|
|
# The formatter wraps code at 88; allow unbreakable strings/URLs up to 100.
|
|
max-line-length = 100
|
|
|
|
[lint.pydocstyle]
|
|
convention = "google"
|
|
|
|
[lint.isort]
|
|
known-first-party = ["paperspec"]
|
|
combine-as-imports = true
|
|
|
|
[lint.flake8-tidy-imports]
|
|
ban-relative-imports = "all"
|
|
|
|
[lint.flake8-pytest-style]
|
|
fixture-parentheses = false
|
|
mark-parentheses = false
|
|
|
|
[lint.flake8-annotations]
|
|
allow-star-arg-any = true
|
|
|
|
[format]
|
|
quote-style = "double"
|
|
indent-style = "space"
|
|
skip-magic-trailing-comma = false
|
|
line-ending = "lf"
|
|
docstring-code-format = true
|
|
docstring-code-line-length = "dynamic"
|