Skip to content

Commit 9f919e8

Browse files
authored
Deprecate py3.8 (#3975)
* Deprecate py3.8
1 parent 48760da commit 9f919e8

File tree

9 files changed

+19
-36
lines changed

9 files changed

+19
-36
lines changed

.github/workflows/ci-branch.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
strategy:
99
matrix:
1010
os: [ubuntu-latest, macos-latest, windows-latest]
11-
python: [ "3.8", "3.9", "3.10", "3.11", "3.12", "3.13" ]
11+
python: [ "3.9", "3.10", "3.11", "3.12", "3.13" ]
1212

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

.github/workflows/ci-pr.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
strategy:
99
matrix:
1010
os: [ubuntu-latest, macos-latest, windows-latest]
11-
python: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
11+
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]
1212

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

CONTRIBUTING.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,9 @@ $ pip install tox
5151
$ tox
5252
5353
# Run a specific test suite
54-
$ tox -e py37 # Run all unit tests against Python 3.7
54+
$ tox -e py39 # Run all unit tests against Python 3.9
5555
```
5656
Tox test suites available:
57-
* **py37**: Unit tests (Python 3.7)
58-
* **py38**: Unit tests (Python 3.8)
5957
* **py39**: Unit tests (Python 3.9)
6058
* **py310**: Unit tests (Python 3.10)
6159
* **py311**: Unit tests (Python 3.11)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ _To get information about the [SAM Transformation](https://docs.aws.amazon.com/A
4040

4141
## Install
4242

43-
Python 3.8+ is supported.
43+
Python 3.9+ is supported.
4444

4545
### Pip
4646

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ readme = {file = ["README.md"], content-type = "text/markdown"}
1414
[project]
1515
name = "cfn-lint"
1616
description = "Checks CloudFormation templates for practices and behaviour that could potentially be improved"
17-
requires-python = ">=3.8"
17+
requires-python = ">=3.9"
1818
license = {text = "MIT no attribution"}
1919
keywords = ["aws", "cloudformation", "lint"]
2020
authors = [
@@ -28,7 +28,6 @@ classifiers = [
2828
"Natural Language :: English",
2929
"Operating System :: OS Independent",
3030
"Programming Language :: Python :: 3",
31-
"Programming Language :: Python :: 3.8",
3231
"Programming Language :: Python :: 3.9",
3332
"Programming Language :: Python :: 3.10",
3433
"Programming Language :: Python :: 3.11",

src/cfnlint/helpers.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import json
1818
import logging
1919
import os
20-
import sys
2120
from io import BytesIO
2221
from typing import Any, Sequence
2322
from urllib.request import Request, urlopen, urlretrieve
@@ -517,14 +516,11 @@ def load_resource(package, filename="us-east-1.json"):
517516
:param filename: filename to load
518517
:return: Json output of the resource laoded
519518
"""
520-
if sys.version_info >= (3, 9):
521-
return json.loads(
522-
pkg_resources.files(package) # pylint: disable=no-member
523-
.joinpath(filename)
524-
.read_text(encoding="utf-8")
525-
)
526-
# pylint: disable=W4902
527-
return json.loads(pkg_resources.read_text(package, filename, encoding="utf-8"))
519+
return json.loads(
520+
pkg_resources.files(package) # pylint: disable=no-member
521+
.joinpath(filename)
522+
.read_text(encoding="utf-8")
523+
)
528524

529525

530526
def is_custom_resource(resource_type):

src/cfnlint/match.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from __future__ import annotations
77

88
import hashlib
9-
import sys
109
import uuid
1110
from dataclasses import InitVar, dataclass, field
1211
from pathlib import Path
@@ -54,12 +53,9 @@ class Match:
5453
rulematch_obj: InitVar[RuleMatch | None] = None
5554

5655
def __post_init__(self, rulematch_obj):
57-
if sys.version_info.major == 3 and sys.version_info.minor > 8:
58-
hex_string = hashlib.md5(
59-
f"{self}".encode("UTF-8"), usedforsecurity=False
60-
).hexdigest()
61-
else:
62-
hex_string = hashlib.md5(f"{self}".encode("UTF-8")).hexdigest()
56+
hex_string = hashlib.md5(
57+
f"{self}".encode("UTF-8"), usedforsecurity=False
58+
).hexdigest()
6359
super().__setattr__("id", str(uuid.UUID(hex=hex_string)))
6460

6561
if rulematch_obj:

src/cfnlint/template/transforms/_language_extensions.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import logging
1111
import random
1212
import string
13-
import sys
1413
from copy import deepcopy
1514
from typing import Any, Iterator, Mapping, MutableMapping, Tuple
1615

@@ -207,16 +206,11 @@ def _replace_string_params(
207206
new_s = deepcopy(s)
208207
for k, v in params.items():
209208
if isinstance(v, dict):
210-
if sys.version_info.major == 3 and sys.version_info.minor > 8:
211-
v = (
212-
hashlib.md5(
213-
json.dumps(v).encode("utf-8"), usedforsecurity=False
214-
)
215-
.digest()
216-
.hex()[0:4]
217-
)
218-
else:
219-
v = hashlib.md5(json.dumps(v).encode("utf-8")).digest().hex()[0:4]
209+
v = (
210+
hashlib.md5(json.dumps(v).encode("utf-8"), usedforsecurity=False)
211+
.digest()
212+
.hex()[0:4]
213+
)
220214
new_s = re.sub(rf"\$\{{{k}\}}", v, new_s)
221215
new_s = re.sub(rf"\&\{{{k}\}}", re.sub("[^0-9a-zA-Z]+", "", v), new_s)
222216

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = py{38,39,310,311,312,313},style
2+
envlist = py{39,310,311,312,313},style
33
isolated_build = true
44

55
[testenv]

0 commit comments

Comments
 (0)