Skip to content

Commit 0123c35

Browse files
authored
Merge pull request #3090 from locustio/drop-support-for-python-3.9
Drop support for Python 3.9
2 parents 3c16e8c + efc565b commit 0123c35

File tree

12 files changed

+228
-412
lines changed

12 files changed

+228
-412
lines changed

Diff for: .github/workflows/tests.yml

-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ jobs:
144144
- { name: "Python 3.12", python: "3.12", os: ubuntu-latest, env: "test:all" }
145145
- { name: "Python 3.11", python: "3.11", os: ubuntu-latest, env: "test:all" }
146146
- { name: "Python 3.10", python: "3.10", os: ubuntu-latest, env: "test:all" }
147-
- { name: "Python 3.9", python: "3.9", os: ubuntu-latest, env: "test:all" }
148147

149148
steps:
150149
- uses: actions/checkout@v4

Diff for: examples/grpc/grpc_user.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
from locust.exception import LocustError
33

44
import time
5-
from typing import Any, Callable
5+
from collections.abc import Callable
6+
from typing import Any
67

78
import grpc
89
import grpc.experimental.gevent as grpc_gevent

Diff for: locust/clients.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -373,12 +373,10 @@ def __exit__(self, exc, value, traceback): # type: ignore[override]
373373
while (
374374
isinstance(
375375
e,
376-
(
377-
requests.exceptions.ConnectionError,
378-
requests.packages.urllib3.exceptions.ProtocolError,
379-
requests.packages.urllib3.exceptions.MaxRetryError,
380-
requests.packages.urllib3.exceptions.NewConnectionError,
381-
),
376+
requests.exceptions.ConnectionError
377+
| requests.packages.urllib3.exceptions.ProtocolError
378+
| requests.packages.urllib3.exceptions.MaxRetryError
379+
| requests.packages.urllib3.exceptions.NewConnectionError,
382380
)
383381
and e.__context__ # Not sure if the above exceptions can ever be the lowest level, but it is good to be sure
384382
):

Diff for: locust/env.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
from __future__ import annotations
22

3+
from collections.abc import Callable
34
from operator import methodcaller
4-
from typing import Callable, TypeVar
5+
from typing import TypeVar
56

67
from configargparse import Namespace
78

Diff for: locust/input_events.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import logging
55
import os
66
import sys
7-
from typing import Callable
7+
from collections.abc import Callable
88

99
import gevent
1010

Diff for: locust/main.py

-3
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,6 @@ def kill_workers(children):
287287

288288
greenlet_exception_handler = greenlet_exception_logger(logger)
289289

290-
if sys.version_info < (3, 10):
291-
logger.warning("Python 3.9 support is deprecated and will be removed soon")
292-
293290
if options.list_commands:
294291
print("Available Users:")
295292
for name in user_classes:

Diff for: locust/runners.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
import traceback
1515
from abc import abstractmethod
1616
from collections import defaultdict
17-
from collections.abc import Iterator, MutableMapping, ValuesView
17+
from collections.abc import Callable, Iterator, MutableMapping, ValuesView
1818
from operator import itemgetter, methodcaller
1919
from types import TracebackType
20-
from typing import TYPE_CHECKING, Any, Callable, NoReturn, TypedDict, cast
20+
from typing import TYPE_CHECKING, Any, NoReturn, TypedDict, cast
2121
from uuid import uuid4
2222

2323
import gevent

Diff for: locust/stats.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
import time
1010
from abc import abstractmethod
1111
from collections import OrderedDict, defaultdict, namedtuple
12-
from collections.abc import Iterable
12+
from collections.abc import Callable, Iterable
1313
from copy import copy
1414
from html import escape
1515
from itertools import chain
1616
from types import FrameType
17-
from typing import TYPE_CHECKING, Any, Callable, NoReturn, Protocol, TypedDict, TypeVar, cast
17+
from typing import TYPE_CHECKING, Any, NoReturn, Protocol, TypedDict, TypeVar, cast
1818

1919
import gevent
2020

Diff for: locust/user/task.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
import random
77
import traceback
88
from collections import deque
9+
from collections.abc import Callable
910
from time import time
1011
from typing import (
1112
TYPE_CHECKING,
12-
Callable,
1313
Protocol,
1414
TypeVar,
1515
final,

Diff for: locust/user/users.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
import logging
1717
import time
1818
import traceback
19-
from typing import Callable, final
19+
from collections.abc import Callable
20+
from typing import final
2021

2122
from gevent import GreenletExit, greenlet
2223
from gevent.pool import Group

Diff for: pyproject.toml

+4-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ description = "Developer-friendly load testing framework"
88
license = { text = "MIT" }
99
dynamic = ["version"]
1010
readme = "README.md"
11-
requires-python = ">=3.9"
11+
requires-python = ">=3.10"
1212
authors = [{ name = "Jonatan Heyman" }, { name = "Lars Holmberg" }]
1313
maintainers = [
1414
{ name = "Lars Holmberg" },
@@ -23,7 +23,6 @@ classifiers = [
2323
"Operating System :: OS Independent",
2424
"Programming Language :: Python",
2525
"Programming Language :: Python :: 3",
26-
"Programming Language :: Python :: 3.9",
2726
"Programming Language :: Python :: 3.10",
2827
"Programming Language :: Python :: 3.11",
2928
"Programming Language :: Python :: 3.12",
@@ -125,7 +124,7 @@ local_scheme = "no-local-version"
125124
[tool.hatch.build.targets.BuildFrontend.hooks.custom]
126125

127126
[tool.ruff]
128-
target-version = "py39"
127+
target-version = "py310"
129128
line-length = 120
130129
extend-exclude = [
131130
"build",
@@ -156,7 +155,7 @@ locust = ["locust"]
156155
[tool.mypy]
157156
# missing type stubs
158157
ignore_missing_imports = true
159-
python_version = "3.9"
158+
python_version = "3.10"
160159

161160
[tool.pyright]
162161
exclude = ["locust/test"]
@@ -199,7 +198,7 @@ run = [
199198
template = "hatch-test"
200199

201200
[[tool.hatch.envs.test.matrix]]
202-
python = ["3.9", "3.10", "3.11", "3.12", "3.13"]
201+
python = ["3.10", "3.11", "3.12", "3.13"]
203202

204203

205204
## Run all unit tests and advanced debugging

0 commit comments

Comments
 (0)