Skip to content

Commit 91b576d

Browse files
authored
Bump openapi deps and support Python 3.8-3.12 (#410)
* Bump openapi deps and support Python 3.8-3.12 * typo * fix deps * cleanup * cleanup
1 parent aa2297e commit 91b576d

File tree

3 files changed

+19
-29
lines changed

3 files changed

+19
-29
lines changed

.github/workflows/tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@ jobs:
1919
fail-fast: false
2020
matrix:
2121
os: [ubuntu-latest, windows-latest, macos-latest]
22-
python-version: ["3.7", "3.11"]
22+
python-version: ["3.8", "3.12"]
2323
include:
2424
- os: windows-latest
2525
python-version: "3.9"
2626
- os: ubuntu-latest
27-
python-version: "pypy-3.8"
27+
python-version: "pypy-3.9"
2828
- os: ubuntu-latest
2929
python-version: "3.10"
3030
- os: macos-latest
31-
python-version: "3.8"
31+
python-version: "3.11"
3232
steps:
3333
- name: Checkout
3434
uses: actions/checkout@v4

jupyterlab_server/test_utils.py

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,7 @@
1212

1313
import tornado.httpclient
1414
import tornado.web
15-
16-
try:
17-
from openapi_core import V30RequestValidator, V30ResponseValidator # type:ignore[attr-defined]
18-
except ImportError:
19-
V30RequestValidator = None
20-
V30ResponseValidator = None
21-
from openapi_core import openapi_request_validator, openapi_response_validator
15+
from openapi_core import V30RequestValidator, V30ResponseValidator
2216
from openapi_core.spec.paths import Spec
2317
from openapi_core.validation.request.datatypes import RequestParameters
2418
from tornado.httpclient import HTTPRequest, HTTPResponse
@@ -152,18 +146,10 @@ def validate_request(response):
152146
openapi_spec = get_openapi_spec()
153147

154148
request = TornadoOpenAPIRequest(response.request, openapi_spec)
155-
if V30RequestValidator:
156-
result = V30RequestValidator(openapi_spec).validate(request)
157-
else:
158-
result = openapi_request_validator.validate(openapi_spec, request)
159-
result.raise_for_errors()
149+
V30RequestValidator(openapi_spec).validate(request)
160150

161151
response = TornadoOpenAPIResponse(response)
162-
if V30ResponseValidator:
163-
result2 = V30ResponseValidator(openapi_spec).validate(request, response)
164-
else:
165-
result2 = openapi_response_validator.validate(openapi_spec, request, response)
166-
result2.raise_for_errors()
152+
V30ResponseValidator(openapi_spec).validate(request, response)
167153

168154

169155
def maybe_patch_ioloop():

pyproject.toml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Distributed under the terms of the Modified BSD License.
33

44
[build-system]
5-
requires = ["hatchling>=1.5"]
5+
requires = ["hatchling>=1.7"]
66
build-backend = "hatchling.build"
77

88
[project]
@@ -20,22 +20,22 @@ classifiers = [
2020
"License :: OSI Approved :: BSD License",
2121
"Programming Language :: Python",
2222
"Programming Language :: Python :: 3 :: Only",
23-
"Programming Language :: Python :: 3.7",
2423
"Programming Language :: Python :: 3.8",
2524
"Programming Language :: Python :: 3.9",
2625
"Programming Language :: Python :: 3.10",
2726
"Programming Language :: Python :: 3.11",
27+
"Programming Language :: Python :: 3.12",
2828
"Typing :: Typed"]
29-
requires-python = ">=3.7"
29+
requires-python = ">=3.8"
3030
dependencies = [
3131
"babel>=2.10",
3232
"importlib_metadata>=4.8.3;python_version<\"3.10\"",
3333
"jinja2>=3.0.3",
3434
"json5>=0.9.0",
35-
"jsonschema>=4.17.3",
35+
"jsonschema>=4.18.0",
3636
"jupyter_server>=1.21,<3",
3737
"packaging>=21.3",
38-
"requests>=2.28",
38+
"requests>=2.31",
3939
]
4040

4141
[[project.authors]]
@@ -65,17 +65,18 @@ docs = [
6565
"jinja2<3.2.0"
6666
]
6767
openapi = [
68-
"openapi_core~=0.16.1",
68+
"openapi_core~=0.18.0",
6969
"ruamel.yaml",
7070
]
7171
test = [
7272
"hatch",
7373
"ipykernel",
7474
"pytest-jupyter[server]>=0.6.2",
75-
"jupyterlab_server[openapi]",
76-
"openapi-spec-validator>=0.5.1,<0.7.0",
75+
"openapi_core~=0.18.0",
76+
"openapi-spec-validator>=0.6.0,<0.7.0",
7777
"sphinxcontrib_spelling",
7878
"requests_mock",
79+
"ruamel.yaml",
7980
"pytest>=7.0",
8081
"pytest-console-scripts",
8182
"pytest-cov",
@@ -108,7 +109,7 @@ nowarn = "test -W default {args}"
108109

109110
[tool.hatch.envs.typing]
110111
features = ["test"]
111-
dependencies = ["mypy>=0.990"]
112+
dependencies = ["mypy>=1.5.1"]
112113
[tool.hatch.envs.typing.scripts]
113114
test = "mypy --install-types --non-interactive {args:jupyterlab_server tests}"
114115

@@ -148,6 +149,9 @@ filterwarnings = [
148149
"module:read property is deprecated:DeprecationWarning",
149150
# From tornado.netutil.bind_sockets
150151
"module:unclosed <socket.socket:ResourceWarning",
152+
# From jupyter_client
153+
"module:datetime.datetime.utcfromtimestamp:DeprecationWarning",
154+
"module:datetime.datetime.utcnow:DeprecationWarning",
151155
]
152156

153157
[tool.coverage.report]

0 commit comments

Comments
 (0)