Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overloaded type annotations not compiled by Sphinx #795

Open
tp832944 opened this issue Oct 2, 2024 · 0 comments
Open

Overloaded type annotations not compiled by Sphinx #795

tp832944 opened this issue Oct 2, 2024 · 0 comments
Labels
bug Something isn't working documentation Improvements or additions to documentation

Comments

@tp832944
Copy link
Contributor

tp832944 commented Oct 2, 2024

What's the problem?

We have used the overload decorator to provide more specific type hints in several places, e.g. in kernels.ScalarValuedKernel, but these are not rendered by Sphinx. Instead, Sphinx just shows the generic Union of several possible types. Moreover, if we rely on overload with class inheritance, no annotations are compiled at all, e.g. kernels.scalar_valued.SquaredExponentialKernel.compute_elementwise.

overload with class inheritance should work as of Python 3.12 - I'm unsure about earlier Python versions. Sphinx issues from a few years ago (pre-Python 3.12) also suggest this should work.

How can we reproduce the issue?

Compile documentation and look at classes mentioned above.

Python version

3.12

Package version

0.2.1

Operating system

Windows

Other packages

No response

Relevant log output

No response

@tp832944 tp832944 added bug Something isn't working new Something yet to be discussed by development team documentation Improvements or additions to documentation and removed new Something yet to be discussed by development team labels Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant