Skip to content

PEP695 generic type syntax interpretion as cross-reference #552

@marlamb

Description

@marlamb

Hi,
since version 3.7.0 I detect a weird error in my documentation build. I have a function using the generic type syntax (overly simplified looking like):

def my_func[Args: ArgType](args: Args): ...

Now the sphinx build issues warnings like

my_file.rst:xx: WARNING: more than one target found for cross-reference 'Args': path.to.other_file.Args [ref.python]

with path.to.other_file.Args indeed being a class definition.

The actual build rst file generated from autoapi looks innocent (only part mentioning the function):

.. autoapisummary::

  path.to.my_file.my_func


.. py:function:: my_func(args)

The line reported by Sphinx is not directly at one of the instances, but close after the autoapisummary.

I am using Python 3.12 and sphinx version 8.2.3.

My questions are:

  • Is this expected behavior?
  • Is it possible to support PEP695 also with names which could be used in independent modules?
  • And is autoapi even the root cause or is some other part of the documentation build responsible to fix the warning?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions