Skip to content

Commit 4acaf84

Browse files
authored
Admin: Drop support for Python 3.8 (#8617)
1 parent 2b282d9 commit 4acaf84

16 files changed

+23
-48
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
runs-on: ubuntu-latest
99
strategy:
1010
matrix:
11-
python-version: [ 3.8, 3.9, "3.10", "3.11", "3.12", "3.13" ]
11+
python-version: [ 3.9, "3.10", "3.11", "3.12", "3.13" ]
1212

1313
steps:
1414
- uses: actions/checkout@v4
@@ -42,7 +42,7 @@ jobs:
4242
strategy:
4343
fail-fast: false
4444
matrix:
45-
python-version: [3.8, 3.9, "3.10", "3.11", "3.12", "3.13"]
45+
python-version: [3.9, "3.10", "3.11", "3.12", "3.13"]
4646
steps:
4747
- uses: actions/checkout@v4
4848
- name: Set up Python ${{ matrix.python-version }}

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ jobs:
2929
- uses: actions/checkout@v4
3030
with:
3131
fetch-depth: 0
32-
- name: Set up Python 3.8
32+
- name: Set up Python 3.12
3333
uses: actions/setup-python@v5
3434
with:
35-
python-version: 3.8
35+
python-version: 3.12
3636
- name: Install dependencies
3737
run: |
3838
python -m pip install --upgrade pip

.github/workflows/tests_decoratormode.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
strategy:
88
fail-fast: false
99
matrix:
10-
python-version: [3.8, 3.9, "3.10", "3.11", "3.12", "3.13"]
10+
python-version: [3.9, "3.10", "3.11", "3.12", "3.13"]
1111

1212
steps:
1313
- uses: actions/checkout@v4

.github/workflows/tests_sdk_dotnet.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ jobs:
99
- uses: actions/checkout@v4
1010
with:
1111
fetch-depth: 0
12-
- name: Set up Python 3.8
12+
- name: Set up Python 3.12
1313
uses: actions/setup-python@v5
1414
with:
15-
python-version: "3.8"
15+
python-version: "3.12"
1616
- name: Start MotoServer
1717
run: |
1818
pip install build

.github/workflows/tests_sdk_java.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ jobs:
99
- uses: actions/checkout@v4
1010
with:
1111
fetch-depth: 0
12-
- name: Set up Python 3.8
12+
- name: Set up Python 3.12
1313
uses: actions/setup-python@v5
1414
with:
15-
python-version: "3.10"
15+
python-version: "3.12"
1616
- name: Start MotoServer
1717
run: |
1818
pip install build

.github/workflows/tests_sdk_ruby.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ jobs:
1616
uses: ruby/setup-ruby@32110d4e311bd8996b2a82bf2a43b714ccc91777
1717
with:
1818
ruby-version: ${{ matrix.ruby-version }}
19-
- name: Set up Python 3.8
19+
- name: Set up Python 3.12
2020
uses: actions/setup-python@v5
2121
with:
22-
python-version: "3.10"
22+
python-version: "3.12"
2323
- name: Start MotoServer
2424
run: |
2525
pip install build

.github/workflows/tests_servermode.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
strategy:
88
fail-fast: false
99
matrix:
10-
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]
10+
python-version: [3.9, "3.10", "3.11", "3.12", "3.13"]
1111

1212
steps:
1313
- uses: actions/checkout@v4

.github/workflows/tests_terraform_examples.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ jobs:
3434
- uses: actions/checkout@v4
3535
with:
3636
fetch-depth: 0
37-
- name: Set up Python 3.8
37+
- name: Set up Python 3.12
3838
uses: actions/setup-python@v5
3939
with:
40-
python-version: "3.8"
40+
python-version: "3.12"
4141
- name: Start MotoServer
4242
run: |
4343
pip install build

moto/core/base_backend.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import re
22
import string
3-
import sys
43
from functools import lru_cache
54
from threading import RLock
65
from typing import (
@@ -29,15 +28,6 @@
2928
if TYPE_CHECKING:
3029
from moto.core.common_models import BaseModel
3130

32-
if sys.version_info >= (3, 9):
33-
from builtins import type as Type
34-
else:
35-
# https://github.com/python/mypy/issues/10068
36-
# Legacy generic type annotation classes
37-
# Deprecated in Python 3.9
38-
# Remove once we no longer support Python 3.8 or lower
39-
from typing import Type
40-
4131

4232
class InstanceTrackerMeta(type):
4333
def __new__(meta, name: str, bases: Any, dct: Dict[str, Any]) -> type:
@@ -339,7 +329,7 @@ def reset(cls) -> None:
339329

340330
def __init__(
341331
self,
342-
backend: "Type[SERVICE_BACKEND]",
332+
backend: type[SERVICE_BACKEND],
343333
service_name: str,
344334
use_boto3_regions: bool = True,
345335
additional_regions: Optional[List[str]] = None,

moto/core/exceptions.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,7 @@ def to_json(self) -> "JsonRESTError":
101101

102102
@classmethod
103103
def extended_environment(cls, extended_templates: Dict[str, str]) -> Environment:
104-
# Can be simplified to cls.templates | extended_templates when we drop Python 3.8 support
105-
# https://docs.python.org/3/library/stdtypes.html#mapping-types-dict
106-
templates = dict(cls.templates.items() | extended_templates.items())
104+
templates = cls.templates | extended_templates
107105
return Environment(loader=DictLoader(templates))
108106

109107

0 commit comments

Comments
 (0)