From cb5abafb1a73f9fccb2acb887096b882673e328d Mon Sep 17 00:00:00 2001 From: Zoheb Shaikh Date: Tue, 13 Aug 2024 10:30:17 +0100 Subject: [PATCH 1/2] updated to auto docs pydantic --- docs/conf.py | 6 ++++++ pyproject.toml | 1 + 2 files changed, 7 insertions(+) diff --git a/docs/conf.py b/docs/conf.py index 33b043e4..d0a4cc19 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -33,6 +33,8 @@ # Use this for generating API docs "sphinx.ext.autodoc", # This can parse google style docstrings + "sphinxcontrib.autodoc_pydantic", + # Used for BaseModel autodoc "sphinx.ext.napoleon", # For linking to external sphinx documentation "sphinx.ext.intersphinx", @@ -84,6 +86,10 @@ ("py:class", "starlette.responses.JSONResponse"), ] +# pydantic models +autodoc_pydantic_model_show_json = True +autodoc_pydantic_model_show_config_summary = False + # Both the class’ and the __init__ method’s docstring are concatenated and # inserted into the main body of the autoclass directive autoclass_content = "both" diff --git a/pyproject.toml b/pyproject.toml index e8e6bf18..cdb3e927 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,6 +42,7 @@ dev = [ "pytest-cov", "ruff", "sphinx-autobuild", + "autodoc-pydantic", "sphinx-copybutton", "sphinx-design", "sphinxcontrib-openapi", From a66c537d70f0f88935d124905c1a551e68dbf80f Mon Sep 17 00:00:00 2001 From: Zoheb Shaikh Date: Tue, 13 Aug 2024 10:33:37 +0100 Subject: [PATCH 2/2] added warning as error --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index cdb3e927..7581f0b2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -107,7 +107,7 @@ commands = pre-commit: pre-commit run --all-files {posargs} type-checking: mypy src tests {posargs} tests: pytest --cov=scanspec --cov-report term --cov-report xml:cov.xml {posargs} - docs: sphinx-{posargs:build -E --keep-going} -T docs build/html + docs: sphinx-{posargs:build -EW --keep-going} -T docs build/html """ [tool.ruff]