Skip to content

Commit 274018e

Browse files
authored
chore: drop support for Python 3.9 (#641)
* Drop support for Python 3.9 - Update requires-python to >=3.10 - Remove Python 3.9 classifier - Update CI to test Python 3.10+ only - Update ruff target-version to py310 - Remove version checks for 3.9 in tests - Update imports to use collections.abc.Callable - Ignore UP045/UP007 for now with TODO to revisit separately * rerun: to check if gpu actions are back * re run
1 parent d1c4492 commit 274018e

File tree

7 files changed

+15
-19
lines changed

7 files changed

+15
-19
lines changed

.github/workflows/ci-testing.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ jobs:
1919
fail-fast: false
2020
matrix:
2121
os: ["ubuntu-latest"]
22-
python-version: ["3.9", "3.10", "3.11"] # todo, "3.12"
22+
python-version: ["3.10", "3.11"] # todo, "3.12"
2323
include:
2424
- { os: "macos-latest", python-version: "3.12" }
2525
- { os: "windows-latest", python-version: "3.11" }
26-
- { os: "ubuntu-22.04", python-version: "3.9", requires: "oldest" }
26+
- { os: "ubuntu-22.04", python-version: "3.10", requires: "oldest" }
2727

2828
timeout-minutes: 35
2929
env:

pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ license = {text = "Apache-2.0"}
1111
authors = [
1212
{name = "Lightning-AI et al.", email = "community@lightning.ai"}
1313
]
14-
requires-python = ">=3.9"
14+
requires-python = ">=3.10"
1515
keywords = ["deep learning", "pytorch", "AI"]
1616
classifiers = [
1717
"Environment :: Console",
@@ -23,8 +23,6 @@ classifiers = [
2323
"License :: OSI Approved :: Apache Software License",
2424
"Operating System :: OS Independent",
2525
"Programming Language :: Python :: 3",
26-
"Programming Language :: Python :: 3.8",
27-
"Programming Language :: Python :: 3.9",
2826
"Programming Language :: Python :: 3.10",
2927
"Programming Language :: Python :: 3.11",
3028
"Programming Language :: Python :: 3.12",
@@ -110,7 +108,7 @@ blank = true
110108

111109
[tool.ruff]
112110
line-length = 120
113-
target-version = "py39"
111+
target-version = "py310"
114112
# Enable Pyflakes `E` and `F` codes by default.
115113
lint.select = [
116114
"E", "W", # see: https://pypi.org/project/pycodestyle
@@ -129,6 +127,8 @@ lint.extend-select = [
129127
]
130128
lint.ignore = [
131129
"E731", # Do not assign a lambda expression, use a def
130+
"UP045", # TODO: non-pep604-annotation-optional
131+
"UP007", # TODO: non-pep604-annotation-union
132132
]
133133
# Exclude a variety of commonly ignored directories.
134134
exclude = [

src/litserve/api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
import json
1717
import warnings
1818
from abc import ABC
19-
from collections.abc import Awaitable
19+
from collections.abc import Awaitable, Callable
2020
from queue import Queue
21-
from typing import TYPE_CHECKING, Callable, Optional, Union
21+
from typing import TYPE_CHECKING, Optional, Union
2222

2323
from pydantic import BaseModel
2424

src/litserve/server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@
2929
import warnings
3030
from abc import ABC, abstractmethod
3131
from collections import deque
32-
from collections.abc import Iterable, Sequence
32+
from collections.abc import Callable, Iterable, Sequence
3333
from contextlib import asynccontextmanager
3434
from queue import Queue
35-
from typing import TYPE_CHECKING, Callable, Literal, Optional, Union
35+
from typing import TYPE_CHECKING, Literal, Optional, Union
3636

3737
import uvicorn
3838
import uvicorn.server

src/litserve/specs/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414
from abc import abstractmethod
15-
from collections.abc import AsyncGenerator, Generator
16-
from typing import TYPE_CHECKING, Callable, Optional, Union
15+
from collections.abc import AsyncGenerator, Callable, Generator
16+
from typing import TYPE_CHECKING, Optional, Union
1717

1818
if TYPE_CHECKING:
1919
from litserve import LitAPI, LitServer

tests/unit/test_cli.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ def test_ensure_lightning_installed(mock_check_call, mock_is_package_installed):
4141
mock_check_call.assert_called_once_with([sys.executable, "-m", "pip", "install", "-U", "lightning-sdk"])
4242

4343

44-
# TODO: Remove this once we have a fix for Python 3.9 and 3.10
45-
@pytest.mark.skipif(sys.version_info[:2] in [(3, 9), (3, 10)], reason="Test fails on Python 3.9 and 3.10")
44+
# TODO: Remove this once we have a fix for Python 3.10
45+
@pytest.mark.skipif(sys.version_info[:2] in [(3, 10)], reason="Test fails on Python 3.10")
4646
@patch("litserve.cli.is_package_installed")
4747
@patch("subprocess.check_call")
4848
@patch("builtins.__import__")
@@ -69,7 +69,7 @@ def side_effect(name, *args, **kwargs):
6969
mock_check_call.assert_called_once_with([sys.executable, "-m", "pip", "install", "-U", "lightning-sdk"])
7070

7171

72-
@pytest.mark.skipif(sys.version_info[:2] in [(3, 9), (3, 10)], reason="Test fails on Python 3.9 and 3.10")
72+
@pytest.mark.skipif(sys.version_info[:2] in [(3, 10)], reason="Test fails on Python 3.10")
7373
@patch("importlib.util.find_spec")
7474
@patch("builtins.__import__")
7575
def test_cli_main_import_error(mock_import, mock_find_spec, capsys):

tests/unit/test_mcp.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import inspect
2-
import sys
32
from typing import Optional
43
from unittest.mock import patch
54

@@ -8,9 +7,6 @@
87
from pydantic import BaseModel, Field
98
from starlette.applications import Starlette
109

11-
if sys.version_info < (3, 10):
12-
pytest.skip("Skipping test_mcp.py on Python < 3.10", allow_module_level=True)
13-
1410
import litserve as ls
1511
from litserve.mcp import (
1612
MCP,

0 commit comments

Comments
 (0)