diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index 394aedb11..eaa49c51f 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -19,11 +19,11 @@ jobs: fail-fast: false matrix: os: ["ubuntu-latest"] - python-version: ["3.9", "3.10", "3.11"] # todo, "3.12" + python-version: ["3.10", "3.11"] # todo, "3.12" include: - { os: "macos-latest", python-version: "3.12" } - { os: "windows-latest", python-version: "3.11" } - - { os: "ubuntu-22.04", python-version: "3.9", requires: "oldest" } + - { os: "ubuntu-22.04", python-version: "3.10", requires: "oldest" } timeout-minutes: 35 env: diff --git a/pyproject.toml b/pyproject.toml index 94562b2c6..d44c10047 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,7 @@ license = {text = "Apache-2.0"} authors = [ {name = "Lightning-AI et al.", email = "community@lightning.ai"} ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["deep learning", "pytorch", "AI"] classifiers = [ "Environment :: Console", @@ -23,8 +23,6 @@ classifiers = [ "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", @@ -110,7 +108,7 @@ blank = true [tool.ruff] line-length = 120 -target-version = "py39" +target-version = "py310" # Enable Pyflakes `E` and `F` codes by default. lint.select = [ "E", "W", # see: https://pypi.org/project/pycodestyle @@ -129,6 +127,8 @@ lint.extend-select = [ ] lint.ignore = [ "E731", # Do not assign a lambda expression, use a def + "UP045", # TODO: non-pep604-annotation-optional + "UP007", # TODO: non-pep604-annotation-union ] # Exclude a variety of commonly ignored directories. exclude = [ diff --git a/src/litserve/api.py b/src/litserve/api.py index b5caf6c40..73e8e80b4 100644 --- a/src/litserve/api.py +++ b/src/litserve/api.py @@ -16,9 +16,9 @@ import json import warnings from abc import ABC -from collections.abc import Awaitable +from collections.abc import Awaitable, Callable from queue import Queue -from typing import TYPE_CHECKING, Callable, Optional, Union +from typing import TYPE_CHECKING, Optional, Union from pydantic import BaseModel diff --git a/src/litserve/server.py b/src/litserve/server.py index 6fc5cc198..399d0dc4b 100644 --- a/src/litserve/server.py +++ b/src/litserve/server.py @@ -29,10 +29,10 @@ import warnings from abc import ABC, abstractmethod from collections import deque -from collections.abc import Iterable, Sequence +from collections.abc import Callable, Iterable, Sequence from contextlib import asynccontextmanager from queue import Queue -from typing import TYPE_CHECKING, Callable, Literal, Optional, Union +from typing import TYPE_CHECKING, Literal, Optional, Union import uvicorn import uvicorn.server diff --git a/src/litserve/specs/base.py b/src/litserve/specs/base.py index 18693488e..37e11d0a2 100644 --- a/src/litserve/specs/base.py +++ b/src/litserve/specs/base.py @@ -12,8 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. from abc import abstractmethod -from collections.abc import AsyncGenerator, Generator -from typing import TYPE_CHECKING, Callable, Optional, Union +from collections.abc import AsyncGenerator, Callable, Generator +from typing import TYPE_CHECKING, Optional, Union if TYPE_CHECKING: from litserve import LitAPI, LitServer diff --git a/tests/unit/test_cli.py b/tests/unit/test_cli.py index 794045703..783ab7618 100644 --- a/tests/unit/test_cli.py +++ b/tests/unit/test_cli.py @@ -41,8 +41,8 @@ def test_ensure_lightning_installed(mock_check_call, mock_is_package_installed): mock_check_call.assert_called_once_with([sys.executable, "-m", "pip", "install", "-U", "lightning-sdk"]) -# TODO: Remove this once we have a fix for Python 3.9 and 3.10 -@pytest.mark.skipif(sys.version_info[:2] in [(3, 9), (3, 10)], reason="Test fails on Python 3.9 and 3.10") +# TODO: Remove this once we have a fix for Python 3.10 +@pytest.mark.skipif(sys.version_info[:2] in [(3, 10)], reason="Test fails on Python 3.10") @patch("litserve.cli.is_package_installed") @patch("subprocess.check_call") @patch("builtins.__import__") @@ -69,7 +69,7 @@ def side_effect(name, *args, **kwargs): mock_check_call.assert_called_once_with([sys.executable, "-m", "pip", "install", "-U", "lightning-sdk"]) -@pytest.mark.skipif(sys.version_info[:2] in [(3, 9), (3, 10)], reason="Test fails on Python 3.9 and 3.10") +@pytest.mark.skipif(sys.version_info[:2] in [(3, 10)], reason="Test fails on Python 3.10") @patch("importlib.util.find_spec") @patch("builtins.__import__") def test_cli_main_import_error(mock_import, mock_find_spec, capsys): diff --git a/tests/unit/test_mcp.py b/tests/unit/test_mcp.py index a70e8b35b..bfc812568 100644 --- a/tests/unit/test_mcp.py +++ b/tests/unit/test_mcp.py @@ -1,5 +1,4 @@ import inspect -import sys from typing import Optional from unittest.mock import patch @@ -8,9 +7,6 @@ from pydantic import BaseModel, Field from starlette.applications import Starlette -if sys.version_info < (3, 10): - pytest.skip("Skipping test_mcp.py on Python < 3.10", allow_module_level=True) - import litserve as ls from litserve.mcp import ( MCP,