Last active
October 1, 2024 03:25
-
-
Save ryanpeach/f88d087a70d186a8c539ed999f6731b3 to your computer and use it in GitHub Desktop.
A good setup.cfg for python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[tool.ruff.lint] | |
select = ["ALL"] | |
ignore = [ | |
"D203", # Should ignore one of D203 or D211 bc they are conflicting | |
"D213", # Should ignore one of D212 or D213 bc they are conflicting | |
"COM812", # Don't require trailing commas | |
"D205", # Don't require 1 blank line between summary and description | |
"TD002", # Don't require author for TODOs | |
"TD003", # Don't require issues for TODOs | |
"S101", # Allow asserts | |
"D107", # Ignore __init__ docstrings | |
"ANN102", # Don't require type annotations for cls | |
"ANN101", # Don't require type annotations for self | |
"PLR0913", # Don't require a certain number of arguments or less for a function | |
"ARG001", # Allow unused function args, for example to fullfill an interface | |
"UP017", # Can't have it both ways ruff | |
"ARG002", # Most of the time this is because you are implementing an ABC | |
"E501", # If black cant fix it I don't want to deal with it | |
"C901", # Complexity is unavoidable sometimes | |
"FBT002", # Why would this even be a problem? | |
"ANN401", # What else could you possibly do? | |
"FIX", # Allow FIXME/TODO/XXX/HACK comments | |
"ERA001", # I don't always want to delete code, especially in research | |
"TCH002", # We are using pydantic, so we need runtime types not just annotations | |
"TCH003", # We are using pydantic, so we need runtime types not just annotations | |
] | |
[tool.ruff.lint.per-file-ignores] | |
"**/test*.py" = [ | |
"S101", # Allow asserts in tests | |
"ANN", # Don't require type annotations in tests | |
"ARG001", # Allow unused function args in tests (for pytest fixtures) | |
"PLR2004", # Allow "magic" values for comparisons | |
"FBT001", # Allow boool positional arg in func (useful for parametrizing) | |
"INP001", # No __init__ required | |
"S113", # Probable use of requests without timeout | |
"D103", # Don't require docstrings for tests | |
"RET504", # Unnecessary variable assignment before return | |
"N802", # Allow camelCase for test functions | |
"UP017", # Can't have it both ways ruff | |
"PGH003", # No need to list the ignore type | |
"T201", # Prints are fine in tests | |
"D100", # This is always "tests module ..." | |
"D104", # This is always "tests folder ..." | |
"T203", # Print allowed in tests | |
] | |
[tool.ruff.lint.pydocstyle] | |
convention = "numpy" | |
[tool.pyright] | |
pythonVersion = "3.10" | |
venvPath = "." | |
venv = ".venv" | |
reportMissingImports = "error" | |
reportMissingTypeStubs = true | |
reportPrivateImportUsage = false | |
typeCheckingMode = "strict" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment