Skip to content

Commit 725b63d

Browse files
committed
Transition to pyproject.toml
1 parent 49de9e2 commit 725b63d

File tree

14 files changed

+172
-184
lines changed

14 files changed

+172
-184
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
pip install --upgrade pip
2828
pip install -r requirements/dev.txt
2929
- name: black
30-
run: black --check setup.py flask_appbuilder
30+
run: black --check flask_appbuilder
3131
- name: flake8
3232
run: flake8 flask_appbuilder
3333
- name: mypy

MANIFEST.in

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

RELEASE.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ Release protocol
1515

1616
7 - checkout and pull master branch
1717

18-
8 - Upload package to Pypi: `python setup.py sdist upload`
18+
8 - Upload package to PyPI: `python -m build && twine upload dist/*`
1919

2020
9 - Update readthedocs with the new master version

flask_appbuilder/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
__author__ = "Daniel Vaz Gaspar"
22
__version__ = "5.2.0"
33

4+
from importlib.metadata import PackageNotFoundError, version
5+
6+
try:
7+
__version__ = version("Flask-AppBuilder")
8+
except PackageNotFoundError:
9+
pass
10+
411
from .actions import action # noqa: F401
512
from .api import ModelRestApi # noqa: F401
613
from .base import AppBuilder # noqa: F401

flask_appbuilder/charts/views.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def _get_chart_widget(
158158
direct=None,
159159
height=None,
160160
definition="",
161-
**args
161+
**args,
162162
):
163163
height = height or self.height
164164
widgets = widgets or dict()
@@ -186,7 +186,7 @@ def _get_chart_widget(
186186
height=height,
187187
value_columns=value_columns,
188188
modelview_name=self.__class__.__name__,
189-
**args
189+
**args,
190190
)
191191
return widgets
192192

@@ -290,7 +290,7 @@ def _get_chart_widget(
290290
widgets=None,
291291
group_by=None,
292292
height=None,
293-
**args
293+
**args,
294294
):
295295
height = height or self.height
296296
widgets = widgets or dict()
@@ -308,7 +308,7 @@ def _get_chart_widget(
308308
height=height,
309309
value_columns=value_columns,
310310
modelview_name=self.__class__.__name__,
311-
**args
311+
**args,
312312
)
313313
return widgets
314314

@@ -344,7 +344,7 @@ def _get_chart_widget(
344344
widgets=None,
345345
direct=None,
346346
height=None,
347-
**args
347+
**args,
348348
):
349349
height = height or self.height
350350
widgets = widgets or dict()
@@ -367,7 +367,7 @@ def _get_chart_widget(
367367
height=height,
368368
value_columns=value_columns,
369369
modelview_name=self.__class__.__name__,
370-
**args
370+
**args,
371371
)
372372
return widgets
373373

@@ -427,7 +427,7 @@ def _get_chart_widget(
427427
group_by=None,
428428
period=None,
429429
height=None,
430-
**args
430+
**args,
431431
):
432432
height = height or self.height
433433
widgets = widgets or dict()
@@ -451,7 +451,7 @@ def _get_chart_widget(
451451
height=height,
452452
value_columns=value_columns,
453453
modelview_name=self.__class__.__name__,
454-
**args
454+
**args,
455455
)
456456
return widgets
457457

flask_appbuilder/fields.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def __init__(
3333
datamodel=None,
3434
col_name=None,
3535
is_related=True,
36-
**kwargs
36+
**kwargs,
3737
):
3838
super(AJAXSelectField, self).__init__(label, validators, **kwargs)
3939
self.datamodel = datamodel
@@ -95,7 +95,7 @@ def __init__(
9595
get_label=None,
9696
allow_blank=False,
9797
blank_text="",
98-
**kwargs
98+
**kwargs,
9999
):
100100
super(QuerySelectField, self).__init__(label, validators, **kwargs)
101101
self.query_func = query_func
@@ -281,7 +281,7 @@ def coerce(value):
281281
default=default,
282282
coerce=coerce,
283283
choices=choices,
284-
**kwargs
284+
**kwargs,
285285
)
286286

287287
def pre_validate(self, form):

flask_appbuilder/filemanager.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def __init__(
2626
namegen=None,
2727
allowed_extensions=None,
2828
permission=0o755,
29-
**kwargs
29+
**kwargs,
3030
):
3131
if "UPLOAD_FOLDER" in current_app.config and not base_path:
3232
base_path = current_app.config["UPLOAD_FOLDER"]
@@ -91,7 +91,7 @@ def __init__(
9191
thumbgen=None,
9292
thumbnail_size=None,
9393
permission=0o755,
94-
**kwargs
94+
**kwargs,
9595
):
9696
# Check if PIL is installed
9797
if Image is None:
@@ -123,7 +123,7 @@ def __init__(
123123
namegen=namegen,
124124
allowed_extensions=allowed_extensions,
125125
permission=permission,
126-
**kwargs
126+
**kwargs,
127127
)
128128

129129
def get_url(self, filename):

flask_appbuilder/filters.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def link_order_filter(self, column, modelview_name):
6666
args["_od_" + modelview_name] = "asc"
6767
return url_for(
6868
request.endpoint,
69-
**dict(list(new_args.items()) + list(args.to_dict().items()))
69+
**dict(list(new_args.items()) + list(args.to_dict().items())),
7070
)
7171

7272
@app_template_filter("link_page")
@@ -79,7 +79,7 @@ def link_page_filter(self, page, modelview_name):
7979
args["page_" + modelview_name] = page
8080
return url_for(
8181
request.endpoint,
82-
**dict(list(new_args.items()) + list(args.to_dict().items()))
82+
**dict(list(new_args.items()) + list(args.to_dict().items())),
8383
)
8484

8585
@app_template_filter("link_page_size")
@@ -92,7 +92,7 @@ def link_page_size_filter(self, page_size, modelview_name):
9292
args["psize_" + modelview_name] = page_size
9393
return url_for(
9494
request.endpoint,
95-
**dict(list(new_args.items()) + list(args.to_dict().items()))
95+
**dict(list(new_args.items()) + list(args.to_dict().items())),
9696
)
9797

9898
@app_template_filter("get_link_next")

pyproject.toml

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
[build-system]
2+
requires = ["setuptools>=68.0"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "Flask-AppBuilder"
7+
dynamic = ["version"]
8+
description = "Simple and rapid application development framework, built on top of Flask. includes detailed security, auto CRUD generation for your models, google charts and much more."
9+
readme = "README.rst"
10+
license = "BSD-3-Clause"
11+
requires-python = ">=3.9"
12+
authors = [
13+
{ name = "Daniel Vaz Gaspar", email = "danielvazgaspar@gmail.com" },
14+
]
15+
classifiers = [
16+
"Development Status :: 5 - Production/Stable",
17+
"Environment :: Web Environment",
18+
"Intended Audience :: Developers",
19+
"Operating System :: OS Independent",
20+
"Programming Language :: Python :: 3.9",
21+
"Programming Language :: Python :: 3.10",
22+
"Programming Language :: Python :: 3.11",
23+
"Programming Language :: Python :: 3.12",
24+
"Programming Language :: Python :: 3.13",
25+
"Topic :: Software Development :: Libraries :: Python Modules",
26+
]
27+
dependencies = [
28+
"apispec[yaml]>=6.0.0, <7",
29+
"colorama>=0.3.9, <1",
30+
"click>=8, <9",
31+
"email_validator>=1.0.5",
32+
"Flask>=2, <4",
33+
"Flask-Babel>=3, <5",
34+
"Flask-Limiter>3, <4",
35+
"Flask-Login>=0.3, <0.7",
36+
"Flask-SQLAlchemy>=2.4.0, <4",
37+
"Flask-WTF>=0.14.2, <2",
38+
"Flask-JWT-Extended>=4.0.0, <5.0.0",
39+
"jsonschema>=3, <5",
40+
"marshmallow>=3.18.0, <5",
41+
"marshmallow-sqlalchemy>=0.22.0, <3.0.0",
42+
"python-dateutil>=2.3, <3",
43+
"prison>=0.2.1, <1.0.0",
44+
"PyJWT>=2.0.0, <3.0.0",
45+
"SQLAlchemy>=1.4.0, <3",
46+
"sqlalchemy-utils>=0.32.21, <1",
47+
"WTForms<4",
48+
"werkzeug<4",
49+
]
50+
51+
[project.optional-dependencies]
52+
jmespath = ["jmespath>=0.9.5"]
53+
oauth = ["Authlib>=0.14, <2.0.0"]
54+
saml = ["python3-saml>=1.15.0"]
55+
talisman = ["flask-talisman>=1.0.0, <2.0"]
56+
57+
[project.urls]
58+
Homepage = "https://github.com/dpgaspar/flask-appbuilder/"
59+
60+
[project.entry-points."flask.commands"]
61+
fab = "flask_appbuilder.cli:fab"
62+
63+
[tool.setuptools]
64+
include-package-data = true
65+
66+
[tool.setuptools.packages.find]
67+
include = ["flask_appbuilder*"]
68+
69+
[tool.setuptools.package-data]
70+
flask_appbuilder = [
71+
"static/**/*",
72+
"templates/**/*",
73+
"translations/**/*",
74+
]
75+
76+
[tool.setuptools.dynamic]
77+
version = { attr = "flask_appbuilder.__version__" }
78+
79+
[tool.mypy]
80+
follow_imports = "skip"
81+
ignore_missing_imports = true
82+
ignore_errors = true
83+
84+
[[tool.mypy.overrides]]
85+
module = "flask_appbuilder.validators"
86+
ignore_errors = false
87+
check_untyped_defs = true
88+
disallow_untyped_calls = false
89+
disallow_untyped_defs = true
90+
warn_unused_ignores = false
91+
92+
[[tool.mypy.overrides]]
93+
module = "flask_appbuilder.base"
94+
ignore_errors = false
95+
check_untyped_defs = true
96+
disallow_untyped_calls = false
97+
disallow_untyped_defs = true
98+
warn_unused_ignores = false
99+
100+
[[tool.mypy.overrides]]
101+
module = "flask_appbuilder.cli"
102+
ignore_errors = false
103+
check_untyped_defs = true
104+
disallow_untyped_calls = false
105+
disallow_untyped_defs = true
106+
warn_unused_ignores = false
107+
108+
[[tool.mypy.overrides]]
109+
module = "flask_appbuilder.models.sqla"
110+
ignore_errors = false
111+
check_untyped_defs = true
112+
disallow_untyped_calls = false
113+
disallow_untyped_defs = true
114+
warn_unused_ignores = false
115+
116+
[[tool.mypy.overrides]]
117+
module = "flask_appbuilder.models.sqla.interface"
118+
ignore_errors = false
119+
check_untyped_defs = true
120+
disallow_untyped_calls = false
121+
disallow_untyped_defs = true
122+
warn_unused_ignores = false
123+
124+
[[tool.mypy.overrides]]
125+
module = "flask_appbuilder.models.sqla.base"
126+
ignore_errors = false
127+
check_untyped_defs = true
128+
disallow_untyped_calls = false
129+
disallow_untyped_defs = true
130+
warn_unused_ignores = false
131+
132+
[[tool.mypy.overrides]]
133+
module = "flask_appbuilder.api.convert"
134+
ignore_errors = false
135+
check_untyped_defs = true
136+
disallow_untyped_calls = false
137+
disallow_untyped_defs = true
138+
warn_unused_ignores = false
139+
140+
[tool.coverage.run]
141+
source = ["flask_appbuilder"]

release.sh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
echo #
2-
echo Removing old dist files
2+
echo Removing old build artifacts
33
echo #
4-
rm -Rf ./dist
4+
rm -Rf ./dist ./build
55
echo #
66
echo Generating dist
77
echo #
8-
python setup.py clean --all sdist bdist_wheel
8+
python -m build
99
echo #
1010
echo Upload to Pypi
1111
echo #
1212
twine upload dist/*
13-

0 commit comments

Comments
 (0)