Skip to content

Commit

Permalink
Merge pull request #2555 from pallets-eco/bau/python-versions
Browse files Browse the repository at this point in the history
Drop support for Python 3.8
  • Loading branch information
samuelhwilliams authored Oct 27, 2024
2 parents ddab93f + 8b25acd commit 6b2d6c8
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 27 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ jobs:
strategy:
fail-fast: false
matrix:
python: ['3.8', '3.9', '3.10', '3.11', '3.12']
python: ['3.9', '3.10', '3.11', '3.12']
tox: ['normal']
include:
- python: '3.8'
tox: 'py38-min'
- python: '3.9'
tox: 'py39-min'
- python: '3.12'
tox: 'py312-noflaskbabel'
- python: '3.8'
tox: 'py38-sqlalchemy1'
- python: '3.9'
tox: 'py39-sqlalchemy1'
- python: '3.12'
tox: 'py312-sqlalchemy1'
services:
Expand Down
1 change: 1 addition & 0 deletions doc/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Changelog

Breaking changes:

* Removed support for Python 3.8.
* Use of the `boto` library has been replaced by `boto3`. S3FileAdmin and S3Storage now accept an `s3_client` parameter taking a `boto3.client('s3')` instance rather than `aws_access_key_id`, `aws_secret_access_key`, and `region` parameters.

2.0.0a1
Expand Down
2 changes: 1 addition & 1 deletion doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ in the `examples` directory.
Support
-------

Python 3.8 or higher.
Python 3.9 or higher.

Indices And Tables
------------------
Expand Down
2 changes: 1 addition & 1 deletion examples/datetime-timezone/app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from datetime import datetime
from zoneinfo import ZoneInfo

from flask import Flask
from flask import jsonify
Expand All @@ -14,7 +15,6 @@
from sqlalchemy.orm import DeclarativeBase
from sqlalchemy.orm import Mapped
from sqlalchemy.orm import mapped_column
from zoneinfo import ZoneInfo


# model
Expand Down
5 changes: 2 additions & 3 deletions flask_admin/_types.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from collections.abc import Sequence
from typing import Any
from typing import Callable
from typing import Dict
from typing import Sequence
from typing import TYPE_CHECKING
from typing import Union

Expand All @@ -10,4 +9,4 @@

T_COLUMN_LIST = Sequence[Union[str, "sqlalchemy.Column"]]
T_FORMATTER = Callable[[Any, Any, Any], Any]
T_FORMATTERS = Dict[type, T_FORMATTER]
T_FORMATTERS = dict[type, T_FORMATTER]
4 changes: 2 additions & 2 deletions flask_admin/blueprints.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def attach_url_defaults_and_value_preprocessor(self, app: Flask, host: str):
# endpoints.
@self.url_defaults
def inject_admin_routes_host_if_required(
endpoint: str, values: t.Dict[str, t.Any]
endpoint: str, values: dict[str, t.Any]
) -> None:
if app.url_map.is_endpoint_expecting(
endpoint, ADMIN_ROUTES_HOST_VARIABLE_NAME
Expand All @@ -50,7 +50,7 @@ def inject_admin_routes_host_if_required(
# required by any of them.
@self.url_value_preprocessor
def strip_admin_routes_host_from_static_endpoint(
endpoint: t.Optional[str], values: t.Optional[t.Dict[str, t.Any]]
endpoint: t.Optional[str], values: t.Optional[dict[str, t.Any]]
) -> None:
if (
endpoint
Expand Down
5 changes: 1 addition & 4 deletions flask_admin/contrib/sqla/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
import logging
import warnings
from typing import cast as t_cast
from typing import Dict
from typing import List
from typing import Optional
from typing import Tuple

from flask import current_app
from flask import flash
Expand Down Expand Up @@ -285,7 +282,7 @@ class MyModelView(ModelView):

column_type_formatters = DEFAULT_FORMATTERS # type: ignore[assignment]

form_choices: Optional[Dict[str, List[Tuple[str, str]]]] = None
form_choices: Optional[dict[str, list[tuple[str, str]]]] = None
"""
Map choices to form fields
Expand Down
3 changes: 1 addition & 2 deletions flask_admin/model/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from math import ceil
from typing import cast
from typing import Optional
from typing import Type

from flask import abort
from flask import current_app
Expand Down Expand Up @@ -577,7 +576,7 @@ class MyModelView(BaseModelView):
prev/next pager buttons.
"""

form: Optional[Type[Form]] = None
form: Optional[type[Form]] = None
"""
Form class. Override if you want to use custom form for your model.
Will completely disable form scaffolding functionality.
Expand Down
7 changes: 3 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@ classifiers = [
'Operating System :: OS Independent',
'Programming Language :: Python',
'Topic :: Software Development :: Libraries :: Python Modules',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
]
requires-python = ">=3.8"
requires-python = ">=3.9"
dependencies = [
"flask>=2.0",
"jinja2>=3.0",
Expand Down Expand Up @@ -117,7 +116,7 @@ source = ["flask_admin", "tests"]
source = ["flask_admin", "*/site-packages"]

[tool.mypy]
python_version = "3.8"
python_version = "3.9"
files = ["flask_admin"]
show_error_codes = true
pretty = true
Expand Down Expand Up @@ -174,7 +173,7 @@ module = [
ignore_missing_imports = true

[tool.pyright]
pythonVersion = "3.8"
pythonVersion = "3.9"
include = ["flask_admin", "tests"]
typeCheckingMode = "basic"

Expand Down
10 changes: 5 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[tox]
minversion = 4.0
envlist =
py3{8,9,10,11,12}
py3{8,12}-sqlalchemy1
py3{9,10,11,12}
py3{9,12}-sqlalchemy1
py312-noflaskbabel # only tested against latest of all configurations, sans flask-babel
py38-min
py39-min
style
typing
docs
Expand All @@ -29,7 +29,7 @@ commands =
pip freeze
pytest -v --tb=short --basetemp={envtmpdir} flask_admin/tests {posargs}

[testenv:py38-min]
[testenv:py39-min]
deps = -r requirements-skip/tests-min.txt
commands =
pip freeze
Expand All @@ -43,7 +43,7 @@ commands = pre-commit run --all-files
[testenv:typing]
deps = -r requirements/typing.txt
commands =
mypy --python-version 3.8
mypy --python-version 3.9
mypy --python-version 3.12

[testenv:docs]
Expand Down

0 comments on commit 6b2d6c8

Please sign in to comment.