Skip to content

Sphinx 4.2.0 potential incompatibility with ElasticSearch  #9971

@FreddieDev

Description

@FreddieDev

Describe the bug

Hi all,

My Python project uses:

  • elasticsearch (7.14.1)
  • elasticsearch-dsl (7.4.0)
  • Sphinx to auto-generated documentation.

Issues started when we updated Sphinx from 3.0.4 to 4.2.0.

Example:
Usage of Elastic's Nested object (from elasticsearch_dsl import Nested), results in the Sphinx error:
TypeError: unhashable type: 'Nested'

Interestingly, Nested from the source code it looks like Nested does contain a hash method, however it's hardcoded to always return 0:
image

If there are further details I can provide, please let me know.
Hoping someone else has ran into this too, or if they can clarify if this is a Sphinx or Elastic issue.

Many thanks

How to Reproduce

My usage was as follows:

class CustomerPackage(InnerDoc):
    """A CustomerPackage Object."""

    @property
    def id(self):
        """Unique GUID for the CustomerPackage."""
        return self.meta.id

    type: Text = Text(analyzer="snowball")
    """ CustomerPackage Type. """

    description: Text = Text(analyzer="snowball")
    """ CustomerPackage Description. """

    lost: bool = Boolean()
    """ Determines if the CustomerPackage was lost in transmission."""

    package_content: Nested(PackageContent) = Nested(PackageContent, multi=False)
    """ Content involved in the message. """

Expected behavior

Prior to the update, Sphinx would build as expected.

Your project

N/A, apologies for lacking detail though I am not permitted to share more source code

Screenshots

No response

OS

Linux

Python version

3.8

Sphinx version

4.2.0

Sphinx extensions

No response

Extra tools

ElasticSearch

Additional context

Elastic ticket:
elastic/elasticsearch-dsl-py#1552

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions