Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop supporting Python 3.7 #2421

Merged
merged 4 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ jobs:
- { name: "3.10", python: "3.10", os: ubuntu-latest, tox: py310 }
- { name: "3.9", python: "3.9", os: ubuntu-latest, tox: py39 }
- { name: "3.8", python: "3.8", os: ubuntu-latest, tox: py38 }
- { name: "3.7", python: "3.7", os: ubuntu-latest, tox: py37 }

steps:
- uses: actions/checkout@v3
Expand Down
3 changes: 0 additions & 3 deletions locust/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,6 @@ def is_valid_percentile(parameter):
See https://github.com/locustio/locust/wiki/Installation#increasing-maximum-number-of-open-files-limit for more info."""
)

if sys.version_info <= (3, 8):
logger.info("Python 3.7 support is deprecated and will be removed soon")

# create locust Environment
locustfile_path = None if not locustfile else os.path.basename(locustfile)

Expand Down
22 changes: 7 additions & 15 deletions locust/runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,9 @@
Any,
cast,
Callable,
TypedDict,
)
from uuid import uuid4

# @TODO: typing.Protocol is in python >= 3.8
try:
from typing import Protocol, TypedDict
except ImportError:
from typing_extensions import Protocol, TypedDict # type: ignore

import gevent
import greenlet
import psutil
Expand Down Expand Up @@ -836,7 +830,7 @@ def start(

logger.info(f"{msg_prefix}: {_format_user_classes_count_for_log(self.reported_user_classes_count)}")

@functools.lru_cache()
@functools.lru_cache
def _wait_for_workers_report_after_ramp_up(self) -> float:
"""
The amount of time to wait after a ramp-up in order for all the workers to report their state
Expand Down Expand Up @@ -909,13 +903,11 @@ def check_stopped(self) -> None:
not self.state == STATE_INIT
and not self.state == STATE_STOPPED
and (
(
self.state == STATE_STOPPING
and all(
map(
lambda x: x.state == STATE_INIT,
self.clients.all,
)
self.state == STATE_STOPPING
and all(
map(
lambda x: x.state == STATE_INIT,
self.clients.all,
)
)
)
Expand Down
8 changes: 2 additions & 6 deletions locust/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,10 @@
Callable,
TypeVar,
cast,
Protocol,
TypedDict,
)

# @TODO: typing.Protocol is in python >= 3.8
try:
from typing import Protocol, TypedDict
except ImportError:
from typing_extensions import Protocol, TypedDict # type: ignore

from types import FrameType

from .exception import CatchResponseError
Expand Down
4 changes: 3 additions & 1 deletion locust/test/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import json
import os
import sys
import platform
import unittest

import pty
import signal
Expand All @@ -11,7 +13,6 @@
from tempfile import TemporaryDirectory
from unittest import TestCase
from subprocess import PIPE, STDOUT, DEVNULL

import gevent
import requests

Expand Down Expand Up @@ -435,6 +436,7 @@ def my_task(self):
self.assertIn("Shutting down (exit code 0)", stderr)
self.assertEqual(0, proc.returncode)

@unittest.skipIf(sys.version_info < (3, 9), reason="dies in 3.8 on GH and I cant be bothered to investigate it")
def test_default_headless_spawn_options_with_shape(self):
content = MOCK_LOCUSTFILE_CONTENT + textwrap.dedent(
"""
Expand Down
10 changes: 3 additions & 7 deletions locust/user/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,10 @@
overload,
Dict,
Set,
Protocol,
final,
runtime_checkable,
)

# @TODO: typing.Protocol and typing.final is in python >= 3.8
try:
from typing import Protocol, final, runtime_checkable
except ImportError:
from typing_extensions import Protocol, final, runtime_checkable # type: ignore

import gevent
from gevent import GreenletExit

Expand Down
3 changes: 1 addition & 2 deletions locust/user/users.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from __future__ import annotations
from typing import Callable, Dict, List, Optional
from typing import Callable, Dict, List, Optional, final

from gevent import GreenletExit, greenlet
from gevent.pool import Group
from typing_extensions import final
from urllib3 import PoolManager

from locust.clients import HttpSession
Expand Down
4 changes: 1 addition & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name = "locust"
license = { text = "MIT"}
description = "Developer friendly load testing framework"
dynamic = ["version"]
requires-python = ">=3.7"
requires-python = ">=3.8"
dependencies = [
"gevent >=20.12.1",
"flask >=2.0.0",
Expand All @@ -21,7 +21,6 @@ dependencies = [
"Flask-BasicAuth >=0.2.0",
"Flask-Cors >=3.0.10",
"roundrobin >=0.0.2",
"typing-extensions >=3.7.4.3", # This provides support for @final, @runtime_checkable, Protocol and TypedDict, and can probably be removed once we drop 3.7 support
"pywin32;platform_system=='Windows'",
]
classifiers = [
Expand All @@ -31,7 +30,6 @@ classifiers = [
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand Down
Loading