Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Align readthedocs sphinx version with pyproject #658

Merged
merged 2 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions docs-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@ aiohttp~=3.6
webargs~=5.5
appdirs~=1.4

sphinx~=4.2 # BSD
sphinx-autoapi~=1.8.4
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~=7.2 # BSD
sphinx-autoapi~=3.0.0
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
Loading