Skip to content

Conversation

pquentin
Copy link
Member

@pquentin pquentin commented Jul 2, 2024

As part of answering to elastic/elasticsearch-py#2606, I wanted to use Intersphinx mappings so that return types like "ObjectApiResponse" in elasticsearch-py docs link to the transport docs. That way, users will be able to see that response.meta.status gives access to the status code. However, ObjectApiResponse is not in the Intersphinx data:

python -m sphinx.ext.intersphinx https://elastic-transport-python.readthedocs.io/en/latest/objects.inv

This pull requests fixes that, and it can be verified with:

python -m sphinx.ext.intersphinx docs/sphinx/_build/html/objects.inv

@@ -36,6 +36,7 @@
]

pygments_style = "sphinx"
pygments_dark_style = "monokai"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is required to make sure code blocks such as the one in HttpHeaders are visible in dark mode.

Comment on lines -47 to +48
"requests": ("https://docs.python-requests.org/en/master", None),
"requests": ("https://docs.python-requests.org/en/latest", None),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a redirection in place, but /latest is the correct place. It also avoids a message about this redirection.

Comment on lines +193 to +198
:ivar int status: HTTP status code
:ivar str http_version: HTTP version being used
:ivar HttpHeaders headers: HTTP headers
:ivar float duration: Number of seconds from start of request to start of response
:ivar NodeConfig node: Node which handled the request
:ivar typing.Optional[str] mimetype: Mimetype to be used by the serializer to decode the raw response bytes.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't able to get Sphinx to show the #: comments, even with autodata, so I placed the information in the class docstring, using instance variables.

@pquentin pquentin merged commit f72f0ae into elastic:main Jul 2, 2024
@pquentin pquentin deleted the response branch July 2, 2024 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants