Skip to content

Commit 38cf5a1

Browse files
Update project configuration and dependencies; remove .flake8 and .setup.cfg, add new settings in pyproject.toml, and adjust .editorconfig for improved code style. Update Python version to 3.12 and version to 4.0.0. Enhance signal handling in signals.py and implement encryption/decryption functions in util.py.
1 parent 671edeb commit 38cf5a1

File tree

10 files changed

+205
-250
lines changed

10 files changed

+205
-250
lines changed

.editorconfig

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,34 @@
1+
# EditorConfig is awesome: https://editorconfig.org
2+
3+
# top-most EditorConfig file
14
root = true
5+
max_line_length = 100
6+
27

8+
# Unix-style newlines with a newline ending every file
39
[*]
410
indent_style = space
511
indent_size = 4
612
insert_final_newline = true
713
trim_trailing_whitespace = true
814
end_of_line = lf
915
charset = utf-8
10-
max_line_length = 88
1116

12-
[*.{yml,yaml,json,js,css,html}]
17+
[*.md]
18+
trim_trailing_whitespace = false
19+
20+
21+
# 2 space indentation
22+
[*.{yml,yaml,css,html}]
1323
indent_size = 2
24+
25+
26+
[*.py]
27+
indent_style = space
28+
indent_size = 4
29+
30+
# Tab indentation (no size specified)
31+
[Makefile]
32+
indent_style = tab
33+
tab_width = 4
34+

.flake8

Lines changed: 0 additions & 19 deletions
This file was deleted.

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ pytest-plugin-work
2121
old
2222
examples/two/
2323
*.sqlite
24-
*.db
24+
*.db

.python-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.7.13
1+
3.12.2

pyproject.toml

Lines changed: 108 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "quart-sqlalchemy"
3-
version = "3.0.2"
3+
version = "4.0.0"
44
description = "SQLAlchemy for humans, with framework adapter for Quart."
55
authors = [
66
{name = "Joe Black", email = "me@joeblack.nyc"},
@@ -11,13 +11,17 @@ dependencies = [
1111
"SQLAlchemy-Utils",
1212
"anyio",
1313
"aiosqlite",
14+
"bases",
15+
"blinker",
16+
"cryptography",
1417
"pydantic",
1518
"tenacity",
19+
"reedsolo",
1620
"sqlapagination",
17-
"exceptiongroup",
21+
"simonspeckciphers",
1822
"python-ulid"
1923
]
20-
requires-python = ">=3.7"
24+
requires-python = ">=3.12"
2125
readme = "README.rst"
2226
license = {text = "MIT"}
2327

@@ -29,6 +33,8 @@ license = {text = "MIT"}
2933
requires = ["setuptools", "setuptools-scm"]
3034
build-backend = "setuptools.build_meta"
3135

36+
[tool.setuptools]
37+
py-modules = ["src"]
3238

3339
[project.optional-dependencies]
3440
sim = [
@@ -37,7 +43,6 @@ sim = [
3743
tests = [
3844
"pytest",
3945
# "pytest-asyncio~=0.20.3",
40-
# "pytest-asyncio @ https://github.com/joeblackwaslike/pytest-asyncio/releases/download/v0.20.4.dev42/pytest_asyncio-0.20.4.dev42-py3-none-any.whl",
4146
"pytest-asyncio @ https://github.com/joeblackwaslike/pytest-asyncio/releases/download/v0.20.4.dev43/pytest_asyncio-0.20.4.dev43-py3-none-any.whl",
4247
"pytest-mock",
4348
"pytest-cov",
@@ -46,35 +51,22 @@ tests = [
4651
dev = [
4752
"pre-commit",
4853
"tox",
49-
"tox-pdm",
5054
"mypy",
51-
"wemake-python-styleguide",
52-
"IPython",
53-
"black",
55+
"ipython",
56+
"ruff",
5457
]
58+
5559
docs = [
5660
"sphinx",
5761
"pallets-sphinx-themes",
5862
"sphinx-issues",
5963
"sphinxcontrib-log-cabinet",
6064
]
6165

62-
[tool.pdm.build]
63-
source-includes = [
64-
"docs/",
65-
# "examples/",
66-
"tests/",
67-
"CHANGES.rst",
68-
"pdm.lock",
69-
"tox.ini",
70-
]
71-
excludes = [
72-
"docs/_build",
73-
]
74-
7566
[tool.pytest.ini_options]
7667
addopts = "-rsx --tb=short --loop-scope session"
7768
testpaths = ["tests"]
69+
pythonpath = ["src"]
7870
filterwarnings = ["error"]
7971
asyncio_mode = "auto"
8072
py311_task = true
@@ -85,23 +77,104 @@ branch = true
8577
source = ["src", "tests"]
8678

8779
[tool.coverage.paths]
88-
source = ["src", "*/site-packages"]
89-
90-
[tool.isort]
91-
profile = "black"
92-
src_paths = ["src", "tests", "examples"]
93-
force_single_line = true
94-
use_parentheses = true
95-
atomic = true
96-
lines_after_imports = 2
97-
line_length = 100
98-
order_by_type = false
99-
known_first_party = ["quart_sqlalchemy", "tests"]
80+
source = ["src"]
81+
82+
83+
[tool.ruff]
84+
# Ruff config: https://docs.astral.sh/ruff/settings
85+
target-version = "py312"
86+
line-length = 100
87+
fix = true
88+
89+
[tool.ruff.lint]
90+
select = [
91+
"A", # flake8-builtins
92+
"B", # flake8-bugbear
93+
"C4", # flake8-comprehensions
94+
"C90", # maccabe
95+
"COM", # flake8-commas
96+
"D", # pydocstyle
97+
"DTZ", # flake8-datetimez
98+
"E", # pycodestyle
99+
"ERA", # flake8-eradicate
100+
"EXE", # flake8-executable
101+
"F", # pyflakes
102+
"FBT", # flake8-boolean-trap
103+
"FLY", # pyflint
104+
"FURB", # refurb
105+
"G", # flake8-logging-format
106+
"I", # isort
107+
"ICN", # flake8-import-conventions
108+
"ISC", # flake8-implicit-str-concat
109+
"LOG", # flake8-logging
110+
"N", # pep8-naming
111+
"PERF", # perflint
112+
"PIE", # flake8-pie
113+
"PL", # pylint
114+
"PT", # flake8-pytest-style
115+
"PTH", # flake8-use-pathlib
116+
"Q", # flake8-quotes
117+
"RET", # flake8-return
118+
"RSE", # flake8-raise
119+
"RUF", # ruff
120+
"S", # flake8-bandit
121+
"SIM", # flake8-simpify
122+
"SLF", # flake8-self
123+
"SLOT", # flake8-slots
124+
"T100", # flake8-debugger
125+
"TRY", # tryceratops
126+
"UP", # pyupgrade
127+
"W", # pycodestyle
128+
"YTT", # flake8-2020
129+
]
130+
ignore = [
131+
"A005", # allow to shadow stdlib and builtin module names
132+
"COM812", # trailing comma, conflicts with `ruff format`
133+
# Different doc rules that we don't really care about:
134+
"D100",
135+
"D104",
136+
"D106",
137+
"D203",
138+
"D212",
139+
"D401",
140+
"D404",
141+
"D405",
142+
"E501", # line too long
143+
"E731", # do not assign lambda
144+
"ISC001", # implicit string concat conflicts with `ruff format`
145+
"ISC003", # prefer explicit string concat over implicit concat
146+
"PLR09", # we have our own complexity rules
147+
"PLR2004", # do not report magic numbers
148+
"PLR6301", # do not require classmethod / staticmethod when self not used
149+
"TRY003", # long exception messages from `tryceratops`
150+
]
151+
152+
# Plugin configs:
153+
flake8-import-conventions.banned-from = [ "ast" ]
154+
flake8-quotes.inline-quotes = "double"
155+
mccabe.max-complexity = 6
156+
pydocstyle.convention = "google"
157+
158+
[tool.ruff.lint.per-file-ignores]
159+
"tests/*.py" = [
160+
"S101", # asserts
161+
"S105", # hardcoded passwords
162+
"S404", # subprocess calls are for tests
163+
"S603", # do not require `shell=True`
164+
"S607", # partial executable paths
165+
"D103", # docstrings on public functions
166+
]
167+
168+
[tool.ruff.format]
169+
preview = true
170+
quote-style = "double"
171+
indent-style = "space"
172+
docstring-code-format = false
100173

101174
[tool.mypy]
102-
python_version = "3.7"
175+
python_version = "3.12"
103176
plugins = ["pydantic.mypy", "sqlalchemy.ext.mypy.plugin"]
104-
files = ["src/quart_sqlalchemy", "tests"]
177+
files = ["src", "tests"]
105178
show_error_codes = true
106179
pretty = true
107180
strict = true
@@ -120,81 +193,3 @@ module = [
120193
]
121194
ignore_missing_imports = true
122195

123-
[tool.pylint.messages_control]
124-
max-line-length = 100
125-
disable = ["invalid-name", "missing-docstring", "protected-access"]
126-
127-
[tool.flakeheaven]
128-
baseline = ".flakeheaven_baseline"
129-
exclude = ["W503"]
130-
131-
[tool.flakeheaven.plugins]
132-
"flake8-*" = ["+*"]
133-
"flake8-docstrings" = [
134-
"+*",
135-
"-D100",
136-
"-D101",
137-
"-D102",
138-
"-D103",
139-
"-D106",
140-
"-D107",
141-
"-D401",
142-
]
143-
"flake8-quotes" = [
144-
"+*",
145-
"-Q000",
146-
]
147-
"flake8-isort" = [
148-
"+*",
149-
"-I001",
150-
"-I003",
151-
"-I005",
152-
]
153-
"flake8-bandit" = [
154-
"+*",
155-
"-S101",
156-
]
157-
"mccabe" = ["+*"]
158-
"pycodestyle" = ["+*"]
159-
"pyflakes" = [
160-
"+*",
161-
]
162-
"wemake-python-styleguide" = [
163-
"+*",
164-
"-WPS110",
165-
"-WPS111",
166-
"-WPS115",
167-
"-WPS118",
168-
"-WPS120", # allow variables with trailing underscore
169-
"-WPS201",
170-
"-WPS204",
171-
"-WPS210",
172-
"-WPS211",
173-
"-WPS214",
174-
"-WPS221",
175-
"-WPS224",
176-
"-WPS225", # allow multiple except in try block
177-
"-WPS226",
178-
"-WPS230",
179-
"-WPS231",
180-
"-WPS232",
181-
"-WPS238", # allow multiple raises in function
182-
"-WPS305", # allow f-strings
183-
"-WPS306",
184-
"-WPS326",
185-
"-WPS337", # allow multi-line conditionals
186-
"-WPS338",
187-
"-WPS420", # allow pass keyword
188-
"-WPS429",
189-
"-WPS430", # allow nested functions
190-
"-WPS431",
191-
"-WPS432",
192-
"-WPS433",
193-
"-WPS435",
194-
"-WPS437",
195-
"-WPS463", # Unsure what it means "Found a getter without a return value"
196-
"-WPS473",
197-
"-WPS503",
198-
"-WPS505",
199-
"-WPS604", # allow pass inside 'class' body
200-
]

0 commit comments

Comments
 (0)