Skip to content

Commit

Permalink
docs: Update sphinx and sphinx-related packages
Browse files Browse the repository at this point in the history
Note: apispec no longer offers validation.
  • Loading branch information
riddell-stan committed Jul 3, 2024
1 parent c675f85 commit fdcdea8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
7 changes: 3 additions & 4 deletions docs-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 4 additions & 4 deletions httpstan/openapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
have not installed ``apispec``.
"""
from typing import Callable
from typing import Optional

import apispec
import apispec.ext.marshmallow
Expand All @@ -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)


Expand All @@ -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
7 changes: 3 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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]
Expand Down

0 comments on commit fdcdea8

Please sign in to comment.