Skip to content

Commit

Permalink
Bump openapi deps and support Python 3.8-3.12 (#410)
Browse files Browse the repository at this point in the history
* Bump openapi deps and support Python 3.8-3.12

* typo

* fix deps

* cleanup

* cleanup
  • Loading branch information
blink1073 authored Sep 12, 2023
1 parent aa2297e commit 91b576d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 29 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.11"
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
22 changes: 13 additions & 9 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,22 +20,22 @@ 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\"",
"jinja2>=3.0.3",
"json5>=0.9.0",
"jsonschema>=4.17.3",
"jsonschema>=4.18.0",
"jupyter_server>=1.21,<3",
"packaging>=21.3",
"requests>=2.28",
"requests>=2.31",
]

[[project.authors]]
Expand Down Expand Up @@ -65,17 +65,18 @@ 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_core~=0.18.0",
"openapi-spec-validator>=0.6.0,<0.7.0",
"sphinxcontrib_spelling",
"requests_mock",
"ruamel.yaml",
"pytest>=7.0",
"pytest-console-scripts",
"pytest-cov",
Expand Down Expand Up @@ -108,7 +109,7 @@ nowarn = "test -W default {args}"

[tool.hatch.envs.typing]
features = ["test"]
dependencies = ["mypy>=0.990"]
dependencies = ["mypy>=1.5.1"]
[tool.hatch.envs.typing.scripts]
test = "mypy --install-types --non-interactive {args:jupyterlab_server tests}"

Expand Down Expand Up @@ -148,6 +149,9 @@ filterwarnings = [
"module:read property is deprecated:DeprecationWarning",
# From tornado.netutil.bind_sockets
"module:unclosed <socket.socket:ResourceWarning",
# From jupyter_client
"module:datetime.datetime.utcfromtimestamp:DeprecationWarning",
"module:datetime.datetime.utcnow:DeprecationWarning",
]

[tool.coverage.report]
Expand Down

0 comments on commit 91b576d

Please sign in to comment.