Skip to content

Commit 53a589c

Browse files
committed
feat: introduce toml-sorter in pre-commit
Makes sure the pyproject.toml is nicely ordered.
1 parent e224d13 commit 53a589c

File tree

2 files changed

+71
-62
lines changed

2 files changed

+71
-62
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@ repos:
3131
hooks:
3232
- id: pretty-format-yaml
3333
args: [--autofix, --indent, '2']
34-
- id: pretty-format-toml
35-
args: [--autofix]
34+
- repo: https://github.com/pappasam/toml-sort
35+
rev: v0.24.2
36+
hooks:
37+
- id: toml-sort-fix
3638
- repo: https://github.com/abravalheri/validate-pyproject
3739
rev: v0.24.1
3840
hooks:

pyproject.toml

Lines changed: 67 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -4,51 +4,51 @@ requires = ["setuptools>=78.0.2"]
44

55
[dependency-groups]
66
dev = [
7-
"flake8>=5.0.4",
8-
"pytest>=4.5",
9-
"responses==0.25.7",
107
"coverage>=3.6",
11-
"pytest-cov>=2.7.1",
8+
"flake8>=5.0.4",
9+
"google-auth-stubs==0.3.0",
10+
"mypy==1.15.0",
1211
"pyright==1.1.400",
12+
"pytest-cov>=2.7.1",
1313
"pytest-xdist>=3.6.1",
14-
"types-requests==2.32.0.20250328",
14+
"pytest>=4.5",
15+
"responses==0.25.7",
1516
"types-defusedxml==0.7.0.20240218",
16-
"types-python-jose==3.4.0.20250224",
1717
"types-oauthlib==3.2.0.20250408",
18+
"types-python-jose==3.4.0.20250224",
1819
"types-requests-oauthlib==2.0.0.20250306",
19-
"google-auth-stubs==0.3.0",
20-
"mypy==1.15.0"
20+
"types-requests==2.32.0.20250328"
2121
]
2222

2323
[project]
2424
authors = [
25-
{name = "Matias Aguirre", email = "matiasaguirre@gmail.com"},
25+
{email = "matiasaguirre@gmail.com", name = "Matias Aguirre"},
2626
{email = "michal@weblate.org", name = "Michal Čihař"}
2727
]
2828
classifiers = [
2929
"Development Status :: 5 - Production/Stable",
3030
"Environment :: Web Environment",
3131
"Intended Audience :: Developers",
32-
"Programming Language :: Python",
3332
"Programming Language :: Python :: 3",
3433
"Programming Language :: Python :: 3.10",
3534
"Programming Language :: Python :: 3.11",
3635
"Programming Language :: Python :: 3.12",
3736
"Programming Language :: Python :: 3.13",
3837
"Programming Language :: Python :: 3.9",
38+
"Programming Language :: Python",
3939
"Topic :: Internet"
4040
]
4141
dependencies = [
42-
"PyJWT>=2.7.0",
4342
"cryptography>=1.4",
4443
"defusedxml>=0.5.0",
4544
"oauthlib>=1.0.3",
45+
"PyJWT>=2.7.0",
4646
"python3-openid>=3.0.10",
4747
"requests-oauthlib>=0.6.1",
4848
"requests>=2.9.1"
4949
]
5050
description = "Python social authentication made simple."
51-
keywords = ["openid", "oauth", "saml", "social auth"]
51+
keywords = ["oauth", "openid", "saml", "social auth"]
5252
license = "BSD-3-Clause"
5353
license-files = ["LICENSE"]
5454
name = "social-auth-core"
@@ -58,10 +58,10 @@ version = "4.5.6"
5858

5959
[project.optional-dependencies]
6060
all = [
61-
"social-auth-core[saml]",
6261
"social-auth-core[azuread]",
63-
"social-auth-core[shopify]",
64-
"social-auth-core[google-onetap]"
62+
"social-auth-core[google-onetap]",
63+
"social-auth-core[saml]",
64+
"social-auth-core[shopify]"
6565
]
6666
allpy3 = [
6767
"social-auth-core[all]"
@@ -72,20 +72,20 @@ azuread = [
7272
# This is present until pip implements supports for PEP 735
7373
# see https://github.com/pypa/pip/issues/12963
7474
dev = [
75-
"flake8>=5.0.4",
76-
"pytest>=4.5",
77-
"responses==0.25.7",
7875
"coverage>=3.6",
79-
"pytest-cov>=2.7.1",
76+
"flake8>=5.0.4",
77+
"google-auth-stubs==0.3.0",
78+
"mypy==1.15.0",
8079
"pyright==1.1.400",
80+
"pytest-cov>=2.7.1",
8181
"pytest-xdist>=3.6.1",
82-
"types-requests==2.32.0.20250328",
82+
"pytest>=4.5",
83+
"responses==0.25.7",
8384
"types-defusedxml==0.7.0.20240218",
84-
"types-python-jose==3.4.0.20250224",
8585
"types-oauthlib==3.2.0.20250408",
86+
"types-python-jose==3.4.0.20250224",
8687
"types-requests-oauthlib==2.0.0.20250306",
87-
"google-auth-stubs==0.3.0",
88-
"mypy==1.15.0"
88+
"types-requests==2.32.0.20250328"
8989
]
9090
google-onetap = [
9191
"google-auth~=2.39.0"
@@ -122,73 +122,73 @@ check_untyped_defs = true
122122
disallow_untyped_defs = true
123123
ignore_missing_imports = true
124124
module = [
125-
"openid.*",
125+
"google.appengine.*",
126126
"onelogin.*",
127-
"shopify.*",
128-
"google.appengine.*"
127+
"openid.*",
128+
"shopify.*"
129129
]
130130

131131
[tool.pyright]
132132
executionEnvironments = [
133-
{root = "social_core/backends/gae.py", reportMissingImports = "none"}
133+
{reportMissingImports = "none", root = "social_core/backends/gae.py"}
134134
]
135135
pythonVersion = "3.9"
136136
reportOptionalMemberAccess = "none"
137137
reportPossiblyUnboundVariable = "none"
138138

139139
[tool.ruff.lint]
140140
extend-safe-fixes = [
141+
"ANN",
141142
"D",
142-
"TCH",
143+
"FA102",
143144
"FLY",
144145
"SIM",
145-
"ANN",
146-
"FA102",
146+
"TCH",
147147
"UP"
148148
]
149149
ignore = [
150-
"COM", # CONFIG: No trailing commas
151-
"D203", # CONFIG: incompatible with D211
152-
"D212", # CONFIG: incompatible with D213
153-
"E501", # WONTFIX: we accept long strings (rest is formatted by ruff)
154-
'ISC001', # CONFIG: formatter
155-
"PT", # CONFIG: Not using pytest
156-
"FIX002", # CONFIG: we use TODO
157-
"TD002", # CONFIG: no detailed TODO documentation is required
158-
"TD003", # CONFIG: no detailed TODO documentation is required
150+
"A001", # TODO: Variable is shadowing a Python builtin
151+
"A002", # TODO: Function argument is shadowing a Python builtin
159152
"ANN", # TODO: Missing type annotations
160-
"D", # TODO: Missing documentation
161-
"B904", # TODO: use raise from
162-
"PLR2004", # TODO: Magic value used in comparison
163-
"PLW2901", # TODO: loop variable overwritten by assignment target
164-
"N", # TODO: Naming issues
165-
"RUF012", # TODO: Type annotations
166153
"ARG001", # TODO: Unused function argument (mostly for API compatibility)
167154
"ARG002", # TODO: Unused method argument (mostly for API compatibility)
168155
"ARG003", # TODO: Unused class method argument
169156
"ARG005", # TODO: Unused lambda argument
170-
"TID252", # TODO: Prefer absolute imports over relative imports from parent modules
171-
"FBT", # TODO: Boolean in function definition
172-
"S105", # TODO: Possible hardcoded password assigned
173157
"B018", # TODO: Found useless expression.
174-
"A001", # TODO: Variable is shadowing a Python builtin
175-
"A002", # TODO: Function argument is shadowing a Python builtin
176-
"ERA001", # TODO: Found commented-out code
158+
"B026", # TODO: Star-arg unpacking after a keyword argument is strongly discouraged
159+
"B904", # TODO: use raise from
160+
"BLE001", # TODO: Do not catch blind exception: `Exception`
161+
"COM", # CONFIG: No trailing commas
162+
"D", # TODO: Missing documentation
163+
"D203", # CONFIG: incompatible with D211
164+
"D212", # CONFIG: incompatible with D213
165+
"DTZ001", # TODO: `datetime.datetime()` called without a `tzinfo` argument
166+
"DTZ005", # TODO: `datetime.datetime.now()` called without a `tz` argument
167+
"E501", # WONTFIX: we accept long strings (rest is formatted by ruff)
177168
"EM101", # TODO: Exception must not use a string literal, assign to variable first
178169
"EM102", # TODO: Exception must not use an f-string literal, assign to variable first
179-
"TRY003", # TODO: Avoid specifying long messages outside the exception class
170+
"ERA001", # TODO: Found commented-out code
171+
"FBT", # TODO: Boolean in function definition
172+
"FIX002", # CONFIG: we use TODO
173+
"ISC003", # TODO: Explicitly concatenated string should be implicitly concatenated
174+
"N", # TODO: Naming issues
175+
"PERF203", # WONTFIX: This rule is only enforced for Python versions prior to 3.11
176+
"PLR2004", # TODO: Magic value used in comparison
177+
"PLW0603", # TODO: Using the global statement to update `BACKENDSCACHE` is discouraged
178+
"PLW2901", # TODO: loop variable overwritten by assignment target
179+
"PT", # CONFIG: Not using pytest
180+
"RUF012", # TODO: Type annotations
180181
"S101", # TODO: Use of `assert` detected
181-
"DTZ001", # TODO: `datetime.datetime()` called without a `tzinfo` argument
182-
"DTZ005", # TODO: `datetime.datetime.now()` called without a `tz` argument
183-
"B026", # TODO: Star-arg unpacking after a keyword argument is strongly discouraged
182+
"S105", # TODO: Possible hardcoded password assigned
183+
"S110", # TODO: `try`-`except`-`pass` detected, consider logging the exception
184184
"S301", # TODO: `pickle` and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue
185185
"S318", # TODO: Using `xml` to parse untrusted data is known to be vulnerable to XML attacks; use `defusedxml` equivalents
186-
"PERF203", # WONTFIX: This rule is only enforced for Python versions prior to 3.11
187-
"ISC003", # TODO: Explicitly concatenated string should be implicitly concatenated
188-
"PLW0603", # TODO: Using the global statement to update `BACKENDSCACHE` is discouraged
186+
"TD002", # CONFIG: no detailed TODO documentation is required
187+
"TD003", # CONFIG: no detailed TODO documentation is required
188+
"TID252", # TODO: Prefer absolute imports over relative imports from parent modules
189+
"TRY003", # TODO: Avoid specifying long messages outside the exception class
189190
"TRY301", # TODO: Abstract `raise` to an inner function
190-
"BLE001", # TODO: Do not catch blind exception: `Exception`
191-
"S110" # TODO: `try`-`except`-`pass` detected, consider logging the exception
191+
'ISC001' # CONFIG: formatter
192192
]
193193
select = ["ALL"]
194194

@@ -205,3 +205,10 @@ max-branches = 15
205205

206206
[tool.setuptools]
207207
packages = ["social_core"]
208+
209+
[tool.tomlsort]
210+
ignore_case = true
211+
sort_inline_arrays = true
212+
sort_inline_tables = true
213+
sort_table_keys = true
214+
spaces_before_inline_comment = 2

0 commit comments

Comments
 (0)