python-template/pyproject.toml
2024-04-25 19:46:36 +02:00

174 lines
5.9 KiB
TOML

[tool.poetry]
name = "python-project"
version = "0.1.0"
description = ""
authors = ["ItsDrike <itsdrike@protonmail.com>"]
readme = "README.md"
packages = [{ include = "src" }]
[tool.poetry.dependencies]
python = "^3.11"
[tool.poetry.group.dev.dependencies]
poethepoet = "^0.25.0"
[tool.poetry.group.lint.dependencies]
ruff = "^0.3.2"
pre-commit = "^3.6.2"
pyright = "^1.1.359"
[tool.poetry.group.test.dependencies]
pytest = "^8.1.1"
pytest-asyncio = "^0.23.6"
pytest-cov = "^5.0.0"
pytest-httpx = "^0.30.0"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
[tool.ruff]
target-version = "py311"
line-length = 119
[tool.ruff.lint]
select = [
"F", # Pyflakes
"W", # Pycodestyle (warnigns)
"E", # Pycodestyle (errors)
"N", # pep8-naming
"I", # isort
"D", # pydocstyle
"DJ", # flake8-django
"DTZ", # flake8-datetimez
"YTT", # flake8-2020
"ANN", # flake8-annotations
"ASYNC", # flake8-async
"S", # flake8-bandit
"B", # flake8-bugbear
"A", # flake8-builtins
"C4", # flake8-comprehensions
"FA", # flake8-future-annotations
"T20", # flake8-print
"PT", # flake8-pytest-style
"Q", # flake8-quotes
"RSE", # flake8-raise
"RET", # flake8-return
"SIM", # flake8-simplify
"TID", # flake8-tidy-imports
"INT", # flake8-gettext
"ISC", # flake8-implicit-str-concat
"PTH", # flake8-use-pathlib
"PGH", # pygrep-hooks
"PIE", # flake8-pie
"PL", # pylint
"RUF", # ruff-specific rules
"UP", # pyupgrade
]
ignore = [
"D100", # Missing docstring in public module
"D104", # Missing docstring in public package
"D105", # Missing docstring in magic method
"D106", # Missing docstring in public nested class
"D107", # Missing docstring in __init__
"D203", # Blank line required before class docstring
"D212", # Multi-line summary should start at first line (incompatible with D211)
"D301", # Use r""" if any backslashes in a docstring
"D401", # First line of docstring should be in imperative mood
"D404", # First word of the docstring should not be "This"
"D405", # Section name should be properly capitalized
"D406", # Section name should end with a newline
"D407", # Missing dashed underline after section
"D408", # Section underline should be in the line following the section's name
"D409", # Section underline should match the length of its name
"D410", # Missing blank line after section
"D411", # Missing blank line before section
"D412", # No blank lines allowed between a section header and its content
"D413", # Missing blank line after last section
"D414", # Section has no content
"D416", # Section name should end with a colon
"D417", # Missing argument descrition in the docstring
"ANN002", # Missing type annotation for *args
"ANN003", # Missing type annotation for **kwargs
"ANN101", # Missing type annotation for self in method
"ANN102", # Missing type annotation for cls in classmethod
"ANN204", # Missing return type annotation for special method
"ANN401", # Dynamically typed expressions (typing.Any) disallowed
"SIM102", # use a single if statement instead of nested if statements
"SIM108", # Use ternary operator {contents} instead of if-else-block
"B008", # Do not perform function call in argument defaults (for fastapi.Depends)
"B904", # Raise without `from` within an `except` clause
"PLR2004", # Using unnamed numerical constants
"PGH003", # Using specific rule codes in type ignores
"E731", # Don't asign a lambda expression, use a def
"S101", # Use of `assert` detected
"S311", # Use `secrets` for random number generation, not `random`
# Redundant rules with ruff-format:
"E111", # Indentation of a non-multiple of 4 spaces
"E114", # Comment with indentation of a non-multiple of 4 spaces
"E117", # Cheks for over-indented code
"D206", # Checks for docstrings indented with tabs
"D300", # Checks for docstring that use ''' instead of """
"Q000", # Checks of inline strings that use wrong quotes (' instead of ")
"Q001", # Multiline string that use wrong quotes (''' instead of """)
"Q002", # Checks for docstrings that use wrong quotes (''' instead of """)
"Q003", # Checks for avoidable escaped quotes ("\"" -> '"')
"COM812", # Missing trailing comma (in multi-line lists/tuples/...)
"COM819", # Prohibited trailing comma (in single-line lists/tuples/...)
"ISC001", # Single line implicit string concatenation ("hi" "hey" -> "hihey")
"ISC002", # Multi line implicit string concatenation
]
[tool.ruff.lint.isort]
order-by-type = false
case-sensitive = true
combine-as-imports = true
# Redundant rules with ruff-format
force-single-line = false # forces all imports to appear on their own line
force-wrap-aliases = false # Split imports with multiple members and at least one alias
lines-after-imports = -1 # The number of blank lines to place after imports
lines-between-types = 0 # Number of lines to place between "direct" and import from imports
split-on-trailing-comma = false # if last member of multiline import has a comma, don't fold it to single line
[tool.ruff.lint.pylint]
max-args = 20
max-branches = 20
max-returns = 20
max-statements = 250
[tool.ruff.lint.per-file-ignores]
"tests/**.py" = [
"ANN", # annotations
"D", # docstrings
"S101", # Use of assert
]
[tool.ruff.format]
line-ending = "lf"
[tool.pyright]
pythonVersion = "3.11"
reportUntypedFunctionDecorator = "error"
reportUntypedClassDecorator = "error"
reportUntypedNamedTuple = "error"
reportTypeCommentUsage = "error"
reportConstantRedefinition = "error"
reportDeprecated = "warning"
reportIncompatibleMethodOverride = "error"
reportOverlappingOverload = "error"
reportUnnecessaryIsInstance = "error"
reportUnnecessaryCast = "error"
reportUnnecessaryComparison = "error"
reportUnnecessaryContains = "error"
reportUnnecessaryTypeIgnoreComment = "error"
reportImplicitOverride = "error"
reportShadowedImports = "error"