Skip to content

Commit 3e018bd

Browse files
authored
Update packages (#29)
* Update dev dependencies. Update ruff rules * Update pre-commit hooks
1 parent a6ea734 commit 3e018bd

File tree

2 files changed

+35
-23
lines changed

2 files changed

+35
-23
lines changed

{{ cookiecutter.project_name.lower().replace(' ', '-') }}/.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.5.0
3+
rev: v4.6.0
44
hooks:
55
- id: check-json
66
- id: check-toml
@@ -22,6 +22,6 @@ repos:
2222
- id: trailing-whitespace
2323

2424
- repo: https://github.com/astral-sh/ruff-pre-commit
25-
rev: v0.4.4
25+
rev: v0.5.5
2626
hooks:
2727
- id: ruff-format

{{ cookiecutter.project_name.lower().replace(' ', '-') }}/pyproject.toml

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ pydantic = "^2.6.4"
1313
{%- endif %}
1414

1515
[tool.poetry.group.dev.dependencies] # https://python-poetry.org/docs/master/managing-dependencies/
16-
mypy = "^1.9.0"
17-
pre-commit = "^3.7.0"
18-
pytest = "^8.1.1"
16+
mypy = "^1.11.1"
17+
pre-commit = "^3.8.0"
18+
pytest = "^8.3.2"
1919
pytest-cov = "^5.0.0"
20-
coverage = "^7.4.4"
21-
typeguard = "^4.2.1"
22-
ruff = "^0.4.4"
23-
safety = "^3.1.0"
24-
deptry = "^0.16.0"
20+
coverage = "^7.6.0"
21+
typeguard = "^4.3.0"
22+
ruff = "^0.5.5"
23+
safety = "^3.2.4"
24+
deptry = "^0.18.0"
2525
{%- if cookiecutter.git_platform == 'gitlab' %}
2626
mypy-gitlab-code-quality = "^1.1.0"
2727
{%- endif %}
@@ -102,44 +102,38 @@ line-length = 100
102102
target-version = "py312"
103103

104104
[tool.ruff.lint]
105-
ignore-init-module-imports = true
106105
select = ["ALL"]
107106
ignore = [
107+
"D", # pydocstyle
108108
"TD", # flake8-todos
109109
"FIX", # flake8-fixme
110110
"ANN", # flake8-annotations (handled by mypy)
111-
"A003", # Class attribute `id` is shadowing a Python builtin
112111
"EM", # flake8-errmsg - String literals in exceptions
113112
"E501", # pycodestyle - line too long (handled by formatter)
114-
"D100", # pydocstyle - Missing docstring in public module
115-
"D101", # pydocstyle - Missing docstring in public class
116-
"D102", # pydocstyle - Missing docstring in public method
117-
"D103", # pydocstyle - Missing docstring in public function
118-
"D104", # pydocstyle - Missing docstring in public package
119-
"D105", # pydocstyle - Missing docstring in magic method
120-
"D106", # pydocstyle - Missing docstring in public nested class
121-
"D107", # pydocstyle - Missing docstring in __init__
122113
"COM812", # forced by ruff formatter
123114
"ISC001", # forced by ruff formatter
115+
"TRY003", # long message for exceptions
116+
"EM101", # allow string literals for exceptions
117+
"EM102", # allow f-string literals for exceptions
124118
]
125119
unfixable = [
126120
"F", # pyflakes
127121
"ERA", # eradicate - commented-out code
128122
]
129123
allowed-confusables = [
130124
"а", "А", "б", "Б", "в", "В", "г", "Г", "е", "Е", "з", "З", "и", "И", "к", "К", "м", "М",
131-
"н", "Н", "о", "О", "р", "Р", "с", "С", "у", "У", "ф", "Ф", "х", "Х" # Allow cyrillic letters
125+
"н", "Н", "о", "О", "р", "Р", "с", "С", "т", "Т", "у", "У", "ф", "Ф", "х", "Х" # Allow cyrillic letters
132126
]
133127

134128
[tool.ruff.lint.per-file-ignores]
135129
"__init__.py" = [
136130
"F401", # Unused import
137131
"F403", # Import star
132+
"ARG001", # Unused function argument (using fixtures from other fixtures)
138133
]
139134
"tests/**/*.py" = [
140135
"S101", # Use of assert detected (assert allowed in tests)
141136
"PLR2004", # Magic value used in comparison
142-
"RUF001", # String contains ambiguous letter
143137
]
144138

145139
[tool.ruff.lint.flake8-tidy-imports] # https://docs.astral.sh/ruff/settings/#lintflake8-tidy-imports
@@ -148,9 +142,15 @@ ban-relative-imports = "all"
148142
[tool.ruff.lint.flake8-boolean-trap] # https://docs.astral.sh/ruff/settings/#lintflake8-bugbear
149143
extend-allowed-calls = ["pydantic.Field", "django.db.models.Value"]
150144

145+
[tool.ruff.lint.flake8-builtins]
146+
builtins-ignorelist = ["id"]
147+
151148
[tool.ruff.lint.flake8-bugbear] # https://docs.astral.sh/ruff/settings/#lintflake8-bugbear
152149
extend-immutable-calls = ["fastapi.Depends", "fastapi.Query", "fastapi.Path", "fastapi.Body", "fastapi_filter.FilterDepends"]
153150

151+
[tool.ruff.lint.flake8-type-checking]
152+
exempt-modules = ["typing", "typing_extensions"]
153+
154154
[tool.ruff.lint.isort] # https://docs.astral.sh/ruff/settings/#isort
155155
section-order = ["future", "typing", "standard-library", "third-party", "first-party", "local-folder"]
156156
lines-between-types = 1
@@ -159,20 +159,32 @@ split-on-trailing-comma = false
159159
[tool.ruff.lint.isort.sections]
160160
"typing" = ["typing", "types", "typing_extensions", "mypy", "mypy_extensions"]
161161

162+
[tool.ruff.lint.pep8-naming]
163+
classmethod-decorators = [
164+
# Allow Pydantic's `@validator` decorator to trigger class method treatment.
165+
"pydantic.validator",
166+
# Allow SQLAlchemy's dynamic decorators, like `@field.expression`, to trigger class method treatment.
167+
"declared_attr",
168+
"expression",
169+
"comparator",
170+
]
171+
162172
[tool.ruff.lint.pycodestyle] # https://docs.astral.sh/ruff/settings/#pycodestyle
163173
max-doc-length = 100
164174

165175
[tool.ruff.lint.pydocstyle] # https://docs.astral.sh/ruff/settings/#pydocstyle
166176
convention = "google"
167177

168178
[tool.ruff.lint.pylint] # https://docs.astral.sh/ruff/settings/#pylint
179+
allow-dunder-method-names = ["__tablename__", "__table_args__"]
169180
allow-magic-value-types = ["int", "str", "bytes"]
170181
max-args = 10
171182
max-statements = 30
172183

173184
[tool.ruff.format]
174-
quote-style = "double"
185+
docstring-code-format = true
175186
indent-style = "space"
187+
quote-style = "double"
176188
skip-magic-trailing-comma = true
177189

178190
[tool.deptry.per_rule_ignores]

0 commit comments

Comments
 (0)