Skip to content

Commit

Permalink
Bump openapi deps and support Python 3.8-3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 committed Sep 9, 2023
1 parent aa2297e commit 1cd8276
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 25 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.7", "3.11"]
python-version: ["3.8", "3.12"]
include:
- os: windows-latest
python-version: "3.9"
- os: ubuntu-latest
python-version: "pypy-3.8"
python-version: "pypy-3.9"
- os: ubuntu-latest
python-version: "3.10"
- os: macos-latest
python-version: "3.8"
python-version: "3.1"
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
20 changes: 3 additions & 17 deletions jupyterlab_server/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,7 @@

import tornado.httpclient
import tornado.web

try:
from openapi_core import V30RequestValidator, V30ResponseValidator # type:ignore[attr-defined]
except ImportError:
V30RequestValidator = None
V30ResponseValidator = None
from openapi_core import openapi_request_validator, openapi_response_validator
from openapi_core import V30RequestValidator, V30ResponseValidator
from openapi_core.spec.paths import Spec
from openapi_core.validation.request.datatypes import RequestParameters
from tornado.httpclient import HTTPRequest, HTTPResponse
Expand Down Expand Up @@ -152,18 +146,10 @@ def validate_request(response):
openapi_spec = get_openapi_spec()

request = TornadoOpenAPIRequest(response.request, openapi_spec)
if V30RequestValidator:
result = V30RequestValidator(openapi_spec).validate(request)
else:
result = openapi_request_validator.validate(openapi_spec, request)
result.raise_for_errors()
V30RequestValidator(openapi_spec).validate(request)

response = TornadoOpenAPIResponse(response)
if V30ResponseValidator:
result2 = V30ResponseValidator(openapi_spec).validate(request, response)
else:
result2 = openapi_response_validator.validate(openapi_spec, request, response)
result2.raise_for_errors()
V30ResponseValidator(openapi_spec).validate(request, response)


def maybe_patch_ioloop():
Expand Down
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Distributed under the terms of the Modified BSD License.

[build-system]
requires = ["hatchling>=1.5"]
requires = ["hatchling>=1.7"]
build-backend = "hatchling.build"

[project]
Expand All @@ -20,13 +20,13 @@ classifiers = [
"License :: OSI Approved :: BSD License",
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.7",
"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",
"Typing :: Typed"]
requires-python = ">=3.7"
requires-python = ">=3.8"
dependencies = [
"babel>=2.10",
"importlib_metadata>=4.8.3;python_version<\"3.10\"",
Expand Down Expand Up @@ -65,15 +65,15 @@ docs = [
"jinja2<3.2.0"
]
openapi = [
"openapi_core~=0.16.1",
"openapi_core~=0.18.0",
"ruamel.yaml",
]
test = [
"hatch",
"ipykernel",
"pytest-jupyter[server]>=0.6.2",
"jupyterlab_server[openapi]",
"openapi-spec-validator>=0.5.1,<0.7.0",
"openapi-spec-validator>=0.6.0,<0.7.0",
"sphinxcontrib_spelling",
"requests_mock",
"pytest>=7.0",
Expand Down

0 comments on commit 1cd8276

Please sign in to comment.