gchq / gchq/coreax

Overloaded type annotations not compiled by Sphinx

Open
#795 1 comment 0 reactions 0 assignees View on GitHub
bug documentation
Dominant language
Python
Stars
43
Forks
6
Avg merge
3d 22h
Merged PRs (30d)
10

Description

### 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_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.