From 35d1af88c82b5126ac8d99dc32df5794709a199e Mon Sep 17 00:00:00 2001 From: Mattia Verga Date: Thu, 22 Dec 2022 08:24:04 +0100 Subject: [PATCH 1/2] Avoid dependency on modern python --- openapi_core/unmarshalling/schemas/factories.py | 6 +++++- pyproject.toml | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/openapi_core/unmarshalling/schemas/factories.py b/openapi_core/unmarshalling/schemas/factories.py index 9440cae9..cf6c60a1 100644 --- a/openapi_core/unmarshalling/schemas/factories.py +++ b/openapi_core/unmarshalling/schemas/factories.py @@ -1,3 +1,4 @@ +import sys import warnings from typing import Any from typing import Dict @@ -6,7 +7,10 @@ from typing import Type from typing import Union -from backports.cached_property import cached_property +if sys.version_info >= (3, 9): + from functools import cached_property +else: + from backports.cached_property import cached_property from jsonschema.protocols import Validator from openapi_schema_validator import OAS30Validator diff --git a/pyproject.toml b/pyproject.toml index b358f8fd..9a2c18b5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -65,7 +65,7 @@ requests = {version = "*", optional = true} werkzeug = "*" typing-extensions = "^4.3.0" jsonschema-spec = "^0.1.1" -backports-cached-property = "^1.0.2" +backports-cached-property = {version = "^1.0.2", python = "<3.9" } [tool.poetry.extras] django = ["django"] From 242ace59e5ff2520236d1d557d595496a2cccc15 Mon Sep 17 00:00:00 2001 From: Mattia Verga Date: Fri, 23 Dec 2022 08:46:46 +0100 Subject: [PATCH 2/2] Avoid backports dependency on py3.8 too --- openapi_core/unmarshalling/schemas/factories.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openapi_core/unmarshalling/schemas/factories.py b/openapi_core/unmarshalling/schemas/factories.py index cf6c60a1..08ef5c39 100644 --- a/openapi_core/unmarshalling/schemas/factories.py +++ b/openapi_core/unmarshalling/schemas/factories.py @@ -7,7 +7,7 @@ from typing import Type from typing import Union -if sys.version_info >= (3, 9): +if sys.version_info >= (3, 8): from functools import cached_property else: from backports.cached_property import cached_property diff --git a/pyproject.toml b/pyproject.toml index 9a2c18b5..652abda2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -65,7 +65,7 @@ requests = {version = "*", optional = true} werkzeug = "*" typing-extensions = "^4.3.0" jsonschema-spec = "^0.1.1" -backports-cached-property = {version = "^1.0.2", python = "<3.9" } +backports-cached-property = {version = "^1.0.2", python = "<3.8" } [tool.poetry.extras] django = ["django"]