Skip to content

Commit

Permalink
Fix documentation build errors
Browse files Browse the repository at this point in the history
The documentation pages for the Pydantic types are now generated but
not included in the table of contents, so they have to be exxluded
for now in order to avoid generating orphaned pages. Also update the
nitpick exclusions to remove some that are now unnecessary and add
another case where autodoc_pydantic generates a spurious link.
  • Loading branch information
rra committed Sep 16, 2024
1 parent 475c6fd commit b718466
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
8 changes: 7 additions & 1 deletion docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,14 @@ API reference
.. automodapi:: safir.middleware.x_forwarded
:include-all-objects:

..
If all objects from safir.pydantic are included, the pages for the
Pydantic types are generated but not linked into any table of contents.
This is probably a but in automodapi and should be checked against later
verisons to see if it's fixed. Once this is fixed, the nitpick exclusions
in documenteer.yaml can also be removed.
.. automodapi:: safir.pydantic
:include-all-objects:

.. automodapi:: safir.redis
:include-all-objects:
Expand Down
15 changes: 8 additions & 7 deletions docs/documenteer.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,20 @@ nitpick_ignore_regex = [
['py:.*', 'starlette.*'],
]
nitpick_ignore = [
['py:class', 'unittest.mock.Base'],
['py:class', 'unittest.mock.CallableMixin'],
# These don't appear to have documentation but show up in the inheritance
# tree.
["py:class", "unittest.mock.Base"],
["py:class", "unittest.mock.CallableMixin"],
# autodoc_pydantic generates some spurious links that can't be resolved.
["py:obj", "ComputedFieldInfo"],
["py:obj", "JobMetadata.id"],
["py:class", "pydantic.BaseModel"],
["py:class", "BaseModel"],
["py:class", "lambda"],
# arq doesn't provide documentation for all of its types.
["py:class", "arq.cron.CronJob"],
["py:class", "arq.typing.StartupShutdown"],
["py:class", "arq.typing.WorkerCoroutine"],
["py:class", "arq.worker.Function"],
# sphinx-automodapi apparently doesn't recognize TypeAlias as an object
# that should have generated documentation, even with include-all-objects.
# Including the documentation for these generates the pages but doesn't
# include them in the table of contents, so for now they're excluded.
["py:obj", "safir.pydantic.EnvAsyncPostgresDsn"],
["py:obj", "safir.pydantic.EnvRedisDsn"],
["py:obj", "safir.pydantic.HumanTimedelta"],
Expand Down

0 comments on commit b718466

Please sign in to comment.