From aa5378625cc07e03c3f4eff140b607b2cd27523d Mon Sep 17 00:00:00 2001 From: mmzeynalli Date: Wed, 15 Jan 2025 00:32:50 +0100 Subject: [PATCH] Dropped python 3.8 support --- .github/workflows/test.yml | 6 ++---- .gitignore | 3 ++- pyproject.toml | 26 ++++++-------------------- src/integrify/api.py | 10 +++++----- src/integrify/epoint/handlers.py | 3 +-- src/integrify/epoint/helper.py | 7 +------ src/integrify/schemas.py | 4 ++-- 7 files changed, 19 insertions(+), 40 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4397bc0..f798f36 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,17 +23,15 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-13, macos-latest, windows-latest] - python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] + python-version: ['3.9', '3.10', '3.11', '3.12'] exclude: - # Python 3.8 and 3.9 are not available on macOS 14 + # Python 3.9 is not available on macOS 14 - os: macos-13 python-version: '3.10' - os: macos-13 python-version: '3.11' - os: macos-13 python-version: '3.12' - - os: macos-latest - python-version: '3.8' - os: macos-latest python-version: '3.9' defaults: diff --git a/.gitignore b/.gitignore index adc6931..b6a0bde 100644 --- a/.gitignore +++ b/.gitignore @@ -165,4 +165,5 @@ cython_debug/ # User Defined test.py *.lcov -site \ No newline at end of file +site +.aider* \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 588b724..f748a07 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,7 +33,6 @@ classifiers = [ "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", @@ -43,7 +42,7 @@ classifiers = [ ] [tool.poetry.dependencies] -python = "^3.8" +python = "^3.9" pydantic = "^2.8.2" httpx = "^0.27.2" @@ -55,37 +54,24 @@ optional = true pytest = "^8.1.1" pytest-mock = "^3.14.0" smokeshow = "^0.4.0" -coverage = [ - { version = "^7.6.3", python = ">=3.9" }, - { version = "7.6.1", python = "3.8" } -] +coverage = "^7.6.3" [tool.poetry.group.dev.dependencies] pytest = "^8.1.1" pytest-mock = "^3.14.0" mypy = "^1.9.0" ruff = "^0.3.5" -pre-commit = [ - { version = "^3.8.0", python = ">=3.9" }, - { version = "^3.5.0", python = "3.8" } -] +pre-commit = "^3.8.0" ptpython = "^3.0.29" bandit = "^1.7.10" -coverage = [ - { version = "^7.6.3", python = ">=3.9" }, - { version = "7.6.1", python = "3.8" } -] -pylint = [ - { version = "^3.3.1", python = ">=3.9" }, -] +coverage = "^7.6.3" +pylint = "^3.3.1" [tool.poetry.group.docs.dependencies] mkdocs-material = {extras = ["imaging"], version = "^9.5.36"} mkdocstrings = {extras = ["python"], version = "^0.26.1"} mkdocs-panzoom-plugin = "^0.1.3" -griffe-pydantic = [ - { version = "^1.0.0", python = ">=3.9" }, -] +griffe-pydantic = "^1.0.0" [tool.ruff] target-version = "py38" diff --git a/src/integrify/api.py b/src/integrify/api.py index aab07c2..e388c85 100644 --- a/src/integrify/api.py +++ b/src/integrify/api.py @@ -1,7 +1,7 @@ import json import string from functools import cached_property -from typing import Any, Callable, Coroutine, Optional, Type, Union +from typing import Any, Callable, Coroutine, Optional, Union from urllib.parse import urljoin import httpx @@ -60,7 +60,7 @@ def add_url(self, route_name: str, url: str, verb: str, base_url: Optional[str] if base_url: self.urls[route_name]['base_url'] = base_url - def set_default_handler(self, handler_class: Type['APIPayloadHandler']) -> None: + def set_default_handler(self, handler_class: type['APIPayloadHandler']) -> None: """Sorğulara default handler setter-i Args: @@ -68,7 +68,7 @@ def set_default_handler(self, handler_class: Type['APIPayloadHandler']) -> None: """ self.default_handler = handler_class() # pragma: no cover - def add_handler(self, route_name: str, handler_class: Type['APIPayloadHandler']) -> None: + def add_handler(self, route_name: str, handler_class: type['APIPayloadHandler']) -> None: """Endpoint-ə handler əlavə etmək method-u Args: @@ -107,8 +107,8 @@ class APIPayloadHandler: def __init__( self, - req_model: Optional[Type[PayloadBaseModel]] = None, - resp_model: Optional[Type[_ResponseT]] = None, + req_model: Optional[type[PayloadBaseModel]] = None, + resp_model: Optional[type[_ResponseT]] = None, ): """ Args: diff --git a/src/integrify/epoint/handlers.py b/src/integrify/epoint/handlers.py index 912ba8a..a28a2fc 100644 --- a/src/integrify/epoint/handlers.py +++ b/src/integrify/epoint/handlers.py @@ -1,6 +1,5 @@ import base64 import json -from typing import Type import httpx @@ -32,7 +31,7 @@ class BasePayloadHandler(APIPayloadHandler): - def __init__(self, req_model: Type[PayloadBaseModel], resp_model: Type[_ResponseT]): + def __init__(self, req_model: type[PayloadBaseModel], resp_model: type[_ResponseT]): super().__init__(req_model, resp_model) def pre_handle_payload(self, *args, **kwds): diff --git a/src/integrify/epoint/helper.py b/src/integrify/epoint/helper.py index 0b49451..6c06ed5 100644 --- a/src/integrify/epoint/helper.py +++ b/src/integrify/epoint/helper.py @@ -1,6 +1,5 @@ import base64 import json -import sys from functools import partial from hashlib import sha1 @@ -9,11 +8,7 @@ __all__ = ['generate_signature', 'decode_callback_data'] -# Python 3.8 support -if sys.version_info >= (3, 9): - _sha1 = partial(sha1, usedforsecurity=False) -else: - _sha1 = sha1 # pragma: no cover +_sha1 = partial(sha1, usedforsecurity=False) def generate_signature(data: str) -> str: diff --git a/src/integrify/schemas.py b/src/integrify/schemas.py index 9e01268..7a90280 100644 --- a/src/integrify/schemas.py +++ b/src/integrify/schemas.py @@ -1,6 +1,6 @@ import json from enum import Enum -from typing import ClassVar, Generic, Set, TypeVar, Union +from typing import ClassVar, Generic, TypeVar, Union from pydantic import BaseModel, Field, field_validator @@ -37,7 +37,7 @@ def convert_to_dict(cls, v: Union[str, bytes]): class PayloadBaseModel(BaseModel): - URL_PARAM_FIELDS: ClassVar[Set[str]] = set() + URL_PARAM_FIELDS: ClassVar[set[str]] = set() @classmethod def from_args(cls, *args, **kwds):