forked from pallets-eco/flask-admin
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpyproject.toml
More file actions
431 lines (385 loc) · 12.6 KB
/
pyproject.toml
File metadata and controls
431 lines (385 loc) · 12.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
[project]
name = "Flask-Admin"
version = "2.0.2"
description = "Simple and extensible admin interface framework for Flask"
readme = "README.md"
license = { file = "LICENSE.txt" }
author = [{ name = "Flask-Admin team" }]
maintainers = [{ name = "Pallets Ecosystem", email = "contact@palletsprojects.com" }]
classifiers = [
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Topic :: Software Development :: Libraries :: Python Modules',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
'Programming Language :: Python :: 3.14',
]
requires-python = ">=3.10"
dependencies = [
"flask>=2.0",
"jinja2>=3.0",
"markupsafe>=2.0",
"werkzeug>=2.0",
"wtforms>=2.3",
"typing_extensions; python_version < '3.11'"
]
[project.optional-dependencies]
sqlalchemy = [
"flask-sqlalchemy>=3",
"sqlalchemy>=1.4",
]
sqlalchemy-lite = [
"flask-sqlalchemy-lite",
]
sqlalchemy-with-utils = [
"Flask-Admin[sqlalchemy]",
"sqlalchemy_utils>=0.38.0",
"sqlalchemy-citext>=1.8.0",
"colour>=0.1.5",
"email_validator>=2",
"arrow>=0.14.0",
]
geoalchemy = [
"Flask-Admin[sqlalchemy]",
"geoalchemy2>=0.14.0",
"shapely>=2",
]
pymongo = ["pymongo>=3.10.0"]
mongoengine = ["mongoengine>=0.29.0"]
peewee = [
"peewee>=3.14.0",
"wtf-peewee>=3.0.4"
]
s3 = ["boto3>=1.33"]
azure-blob-storage = ["azure-storage-blob>=12.0.0"]
images = ["pillow>=10.0.0"]
export = ["tablib>=3.0.0"]
rediscli = ["redis>=4.0.0"]
translation = ["flask-babel>=3.0.1"]
all = [
"Flask-Admin[sqlalchemy]",
"Flask-Admin[sqlalchemy-lite]",
"Flask-Admin[sqlalchemy-with-utils]",
"Flask-Admin[geoalchemy]",
"Flask-Admin[pymongo]",
"Flask-Admin[mongoengine]",
"Flask-Admin[peewee]",
"Flask-Admin[s3]",
"Flask-Admin[azure-blob-storage]",
"Flask-Admin[images]",
"Flask-Admin[export]",
"Flask-Admin[rediscli]",
"Flask-Admin[translation]",
]
[dependency-groups]
dev = [
"flask-admin[all]",
"tox<4.30", # https://github.com/tox-dev/tox/issues/3602
"tox-uv",
{include-group = "pre-commit"},
{include-group = "docs"},
{include-group = "tests"},
{include-group = "typing"},
]
pre-commit = [
"pre-commit",
"pre-commit-uv",
]
docs = [
"flask-admin[all]",
"pallets-sphinx-themes",
"sphinx",
"sphinx-intl>=2.3.1",
"sphinxcontrib-log-cabinet",
]
tests = [
"flake8",
"flask[async]",
"pylint",
"pytest",
"pytest-cov",
"moto",
"botocore>=1.35",
"psycopg2-binary",
"beautifulsoup4",
]
typing = [
"mypy",
"pyright",
"pytest",
"types-Pillow", # keep until pillow < 4.13.0
"types-beautifulsoup4", # keep for beautifulsoup 4.12
"types-boto3", # keep
"types-peewee", # for peewee==3.18.2
"types-WTForms", # for WTForms 3.2.1
"types-shapely", # for shapely==2.1.*
]
[project.urls]
Documentation = "https://flask-admin.readthedocs.io"
Changes = "https://github.com/pallets-eco/flask-admin/releases/"
Source = "https://github.com/pallets-eco/flask-admin/"
Chat = "https://discord.gg/pallets"
[build-system]
requires = ["flit_core<4"]
build-backend = "flit_core.buildapi"
[tool.flit.module]
name = "flask_admin"
[tool.uv]
default-groups = ["dev", "pre-commit", "tests", "typing"]
[tool.uv.sources]
flask-admin = { workspace = true }
[tool.pytest.ini_options]
testpaths = ["flask_admin/tests"]
markers = [
"flask_babel: requires Flask-Babel to be installed"
]
filterwarnings = [
"error",
# TODO: remove the ignored deprecation warning when support for WTForms 3 has been added.
"ignore:Flags should be stored in dicts and not in tuples. The next version of WTForms will abandon support for flags in tuples.:DeprecationWarning",
# Werkzeug is responsible for the below deprecation warning; remove when they have updated their code.
"default:ast\\.Str is deprecated and will be removed in Python 3\\.14:DeprecationWarning",
"default:Attribute s is deprecated and will be removed in Python 3\\.14:DeprecationWarning",
# Werkzeug <3 with Flask>2.2. Remove when werkzeug min version is >= 3.0
"default:'werkzeug\\.urls\\.url_parse' is deprecated and will be removed in Werkzeug 3\\.0:DeprecationWarning",
"default:'werkzeug\\.urls\\.URL' is deprecated and will be removed in Werkzeug 3\\.0:DeprecationWarning",
# Flask is responsible for the below deprecation warning; remove when they have updated their code.
"default:'pkgutil\\.get_loader' is deprecated and slated for removal in Python 3\\.14:DeprecationWarning",
"default:'pkgutil\\.find_loader' is deprecated and slated for removal in Python 3\\.14:DeprecationWarning",
"default:datetime\\.datetime\\.utcnow\\(\\) is deprecated and scheduled for removal in a future version:DeprecationWarning",
# `flask.testing` accesses this attribute; remove when they have updated their code.
"default:The '__version__' attribute is deprecated and will be removed in Werkzeug 3\\.1\\.:DeprecationWarning",
# raised by flask-sqlalchemy https://github.com/pallets-eco/flask-sqlalchemy/issues/1379
"ignore:Exception ignored in.*sqlite3.Connection:pytest.PytestUnraisableExceptionWarning",
# raised by flask-sqlalchemy https://github.com/pallets-eco/flask-sqlalchemy/issues/1379
"ignore:unclosed database in <sqlite3\\.Connection object at 0x[0-9a-f]+>:ResourceWarning",
# raised at end of test run, maybe by Werkzeug?
"ignore:unclosed file <_io.FileIO name='/home/runner/work/flask-admin/flask-admin/flask_admin/static/bootstrap/bootstrap4/css/bootstrap.min.css' mode='rb' closefd=True>:ResourceWarning",
# remove once the deprecated ModelView(Model, db.session) API is fully retired
"ignore:Passing a session object directly is deprecated.*:DeprecationWarning",
]
[tool.coverage.run]
branch = true
source = ["flask_admin", "tests"]
[tool.coverage.paths]
source = ["flask_admin", "*/site-packages"]
[tool.mypy]
python_version = "3.10"
files = ["flask_admin"]
show_error_codes = true
pretty = true
strict = true
# Strongly recommend enabling this one as soon as you can
check_untyped_defs = true
warn_unused_configs = true
warn_redundant_casts = true
warn_unused_ignores = true
strict_equality = true
strict_concatenate = true
# These shouldn't be too much additional work, but may be tricky to
# get passing if you use a lot of untyped libraries
disallow_subclassing_any = true
disallow_untyped_decorators = true
disallow_any_generics = true
# These next few are various gradations of forcing use of type annotations
disallow_untyped_calls = false
disallow_incomplete_defs = false
disallow_untyped_defs = false
# This one isn't too hard to get passing, but return on investment is lower
no_implicit_reexport = false
# This one can be tricky to get passing if you use a lot of untyped libraries
warn_return_any = false
[[tool.mypy.overrides]]
module = [
"arrow",
"azure.*",
"bson.*",
"citext",
"colour",
"flask_babel",
"flask_wtf",
"gridfs",
"marker",
"playhouse.*",
"pymongo",
"mongoengine.*",
"sqlalchemy.*",
"sqlalchemy_utils",
"tablib",
"wtforms.*",
"wtfpeewee.*",
]
ignore_missing_imports = true
# TODO: reenable after pyright test pass
#[tool.pyright]
#pythonVersion = "3.10"
#include = ["flask_admin", "tests"]
#typeCheckingMode = "basic"
[tool.ruff]
src = ["flask_admin"]
fix = true
show-fixes = true
output-format = "full"
[tool.ruff.lint]
select = [
"B", # flake8-bugbear
"E", # pycodestyle error
"F", # pyflakes
"I", # isort
"UP", # pyupgrade
"W", # pycodestyle warning
]
ignore = [
"UP007", # Use X | Y for type annotations; doesn't work with some of our (stringy) type definitions - should aim to resolve this
]
[tool.ruff.lint.isort]
force-single-line = true
order-by-type = false
[tool.tox]
env_list = [
"py310", "py311", "py312", "py313", "py314",
"py310-sqlalchemy1", "py314-sqlalchemy1",
"py314-noflaskbabel",
"py310-min",
"style",
"typing",
"docs",
]
[tool.tox.env_run_base]
description = "pytest on latest dependency versions"
runner = "uv-venv-lock-runner"
package = "wheel"
wheel_build_env = ".pkg"
extras = ["all"]
setenv = { SQLALCHEMY_SILENCE_UBER_WARNING = "1" }
pass_env = ["AZURE_STORAGE_CONNECTION_STRING", "SQLALCHEMY_DATABASE_URI", "MONGOCLIENT_HOST"]
constrain_package_deps = true
use_frozen_constraints = true
dependency_groups = ["tests"]
env_tmp_dir = "{toxworkdir}/tmp/{envname}"
commands = [[
"pytest", "-v", "--tb=short", "--basetemp={env_tmp_dir}",
{replace = "posargs", default = [], extend = true},
]]
[tool.tox.env.py310-min]
description = "pytest on minimum dependency versions"
base_python = ["3.10"]
commands = [
[
"uv", "pip", "install",
"flask==2.2.0", # flask-sqlalchemy depends on flask >=2.2
"werkzeug==2.3.8",
"wtforms==2.3.0",
"sqlalchemy==1.4.18",
"sqlalchemy_utils==0.38.0",
"sqlalchemy-citext==1.8.0",
"flask-sqlalchemy==3.0.0",
"colour==0.1.5",
"email_validator==2.0.0",
"arrow==0.14.0",
"numpy<2.0", # old versions of shapely are built with numpy1.x
"geoalchemy2==0.14.0",
"shapely==2",
"boto3==1.33.0",
"pymongo==3.10.0",
"mongoengine==0.29.0",
"peewee==3.14.0",
"wtf-peewee==3.0.4",
"azure-storage-blob==12.0.0",
"pillow==10.0.0",
"flask-babel==3.0.1",
"tablib==3.0.0",
"redis==4.0.0",
],
[
"pytest", "-v", "--tb=short", "--basetemp={env_tmp_dir}",
{replace = "posargs", default = [], extend = true},
],
]
[tool.tox.env.py310-sqlalchemy1]
description = "pytest with SQLAlchemy 1.x on Python 3.10"
base = ["env_run_base"]
base_python = ["3.10"]
commands = [
["uv", "pip", "install", "sqlalchemy>=1.4,<2"],
["uv", "pip", "install", "flask-sqlalchemy<=3.0.5"],
[
"pytest", "-v", "--tb=short", "--basetemp={env_tmp_dir}",
{replace = "posargs", default = [], extend = true},
],
]
[tool.tox.env.py314-sqlalchemy1]
description = "pytest with SQLAlchemy 1.x on Python 3.14"
base = ["env_run_base"]
base_python = ["3.14"]
commands = [
["uv", "pip", "install", "sqlalchemy>=1.4,<2"],
["uv", "pip", "install", "flask-sqlalchemy<=3.0.5"],
[
"pytest", "-v", "--tb=short", "--basetemp={env_tmp_dir}",
{replace = "posargs", default = [], extend = true},
],
]
[tool.tox.env.py314-noflaskbabel]
description = "pytest without flask-babel"
base = ["env_run_base"]
commands = [
["uv", "pip", "uninstall", "flask-babel"],
[
"pytest", "-v", "--tb=short", "--basetemp={env_tmp_dir}",
{replace = "posargs", default = [], extend = true},
],
]
[tool.tox.env.style]
description = "run all pre-commit hooks on all files"
dependency_groups = ["pre-commit"]
skip_install = true
commands = [["pre-commit", "run", "--all-files"]]
[tool.tox.env.typing]
description = "run static type checkers"
dependency_groups = ["typing"]
commands = [
["mypy", "--python-version", "3.10"],
["mypy", "--python-version", "3.14"],
["mypy", "--python-version", "3.14",
"--ignore-missing-imports",
"--disable-error-code", "name-defined", # allow flask_sqlalchemy's db.Model in examples
"--no-warn-unused-ignores", # prevent conflict with mypy 1st run on src folder
"--allow-subclassing-any", # flask-slqalchemy db.Model is Any
"examples", ]
# TODO: reenable after pyright test pass
# ["pyright"],
]
[tool.tox.env.docs]
description = "build docs"
dependency_groups = ["docs"]
commands = [["sphinx-build", "-E", "-W", "-b", "dirhtml", "doc", "doc/_build/dirhtml"]]
# [tool.tox.env.docs-auto]
# description = "continuously rebuild docs and start a local server"
# dependency_groups = ["docs", "docs-auto"]
# commands = [["sphinx-autobuild", "-W", "-b", "dirhtml", "--watch", "src", "docs", "docs/_build/dirhtml"]]
# [tool.tox.env.update-actions]
# description = "update GitHub Actions pins"
# labels = ["update"]
# dependency_groups = ["gha-update"]
# skip_install = true
# commands = [["gha-update"]]
[tool.tox.env.update-pre_commit]
description = "update pre-commit pins"
labels = ["update"]
dependency_groups = ["pre-commit"]
skip_install = true
commands = [["pre-commit", "autoupdate", "--freeze", "-j4"]]
[tool.tox.env.update-requirements]
description = "update uv lock"
labels = ["update"]
dependency_groups = []
no_default_groups = true
skip_install = true
commands = [["uv", "lock", {replace = "posargs", default = ["-U"], extend = true}]]