From fdcdea89b6e2b16b6219981be549e33b8576d267 Mon Sep 17 00:00:00 2001 From: "A. Riddell" Date: Wed, 3 Jul 2024 08:35:42 -0400 Subject: [PATCH] docs: Update sphinx and sphinx-related packages Note: apispec no longer offers validation. --- docs-requirements.txt | 7 +++---- httpstan/openapi.py | 8 ++++---- pyproject.toml | 7 +++---- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/docs-requirements.txt b/docs-requirements.txt index a5a69e388..bd9e7a996 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -9,11 +9,10 @@ appdirs~=1.4 sphinx~=7.2 # BSD sphinx-autoapi~=3.0.0 -sphinx-rtd-theme~=1.0.0 -sphinxcontrib-openapi>=0.8.1,<0.9 -jsonschema>=4.10.0,<4.18.0 # newer versions break sphinxcontrib-openapi +sphinx-rtd-theme~=2.0.0 +sphinxcontrib-openapi~=0.8.4 sphinxcontrib-redoc~=1.6 # required for building OpenAPI spec -apispec[yaml,validation]~=4.0 +apispec[yaml]~=6.0 marshmallow~=3.10 # needed for apidocs diff --git a/httpstan/openapi.py b/httpstan/openapi.py index 69520cdc0..2ea351930 100644 --- a/httpstan/openapi.py +++ b/httpstan/openapi.py @@ -5,7 +5,7 @@ have not installed ``apispec``. """ -from typing import Callable +from typing import Optional import apispec import apispec.ext.marshmallow @@ -25,11 +25,12 @@ class DocPlugin(apispec.BasePlugin): def init_spec(self, spec: apispec.APISpec) -> None: super().init_spec(spec) - def operation_helper(self, operations: dict, view: Callable, **kwargs: dict) -> None: + def operation_helper(self, path: Optional[str], operations: dict, **kwargs: dict) -> None: # type: ignore """Operation helper that parses docstrings for operations. Adds a ``func`` parameter to `apispec.APISpec.path`. """ - doc_operations = apispec.yaml_utils.load_operations_from_docstring(view.__doc__) + view = kwargs["view"] + doc_operations = apispec.yaml_utils.load_operations_from_docstring(view.__doc__) # type: ignore operations.update(doc_operations) @@ -55,5 +56,4 @@ def openapi_spec() -> apispec.APISpec: spec.path(path="/v1/models/{model_id}/fits/{fit_id}", view=views.handle_get_fit) spec.path(path="/v1/models/{model_id}/fits/{fit_id}", view=views.handle_delete_fit) spec.path(path="/v1/operations/{operation_id}", view=views.handle_get_operation) - apispec.utils.validate_spec(spec) return spec diff --git a/pyproject.toml b/pyproject.toml index 039950822..66557d12c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,7 +41,7 @@ numpy = "^1.19" [tool.poetry.dev-dependencies] pytest = "^6.2" pytest-asyncio = "^0.15" -apispec = {version = "^4.0", extras = ["yaml", "validation"]} +apispec = {version = "^6.0", extras = ["yaml"]} autoflake = "^1.4" black = "22.3.0" isort = "^5.9" @@ -51,9 +51,8 @@ flake8 = "^7.0.0" # NOTE: when changing these, update docs-requirements.txt sphinx = "^7.2" sphinx-autoapi = "^3.0.0" -sphinx-rtd-theme = "^1.0.0" -sphinxcontrib-openapi = "^0.8.1" -jsonschema = ">=4.10.0,<4.18.0" # newer versions break sphinxcontrib-openapi +sphinx-rtd-theme = "^2.0.0" +sphinxcontrib-openapi = "^0.8.4" sphinxcontrib-redoc = "^1.6" [tool.black]