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

Don't omit empty parentheses for hardcoded class docstrings #10281

Closed
laurensvalk opened this issue Mar 21, 2022 · 2 comments
Closed

Don't omit empty parentheses for hardcoded class docstrings #10281

laurensvalk opened this issue Mar 21, 2022 · 2 comments
Labels
type:enhancement enhance or introduce a new feature

Comments

@laurensvalk
Copy link

Is your feature request related to a problem? Please describe.
It would be nice to show empty parentheses () for overloaded classes, such that all signatures look consistent. Right now (Sphinx 4.4.0), they look different:

image

Describe the solution you'd like
Show empty parentheses for overloaded class signatures:

class MyBool()
class MyBool(x: any)

Additional context
Originally reported here: pybricks/pybricks-api#85

Related issue:
#10280

@laurensvalk laurensvalk added the type:enhancement enhance or introduce a new feature label Mar 21, 2022
@laurensvalk laurensvalk changed the title Don't omit empty parentheses for overloaded class signatures Don't omit empty parentheses for hardcoded class docstrings Apr 2, 2022
@laurensvalk
Copy link
Author

laurensvalk commented Apr 2, 2022

If we take the specific case where docstrings are manually overridden, then this could perhaps be considered as a bug.

Take this example:

class MyComplex:

    def __init__(self, *args):
        """MyComplex()
        MyComplex(string: str)
        MyComplex(a: Union[float, complex], b: Union[float, complex] = 0)

        The () are omitted on first case even though they are entered explicitly.
        """

This gets rendered as:

image

Workaround (and possible minor fix without too many breaking changes).

It does render it if you add a zero-size whitespace character.

image

This gives:

image

It looks like every other character gets rendered too except a normal space.

So perhaps this could be make to work by allowing a normal space here.

@laurensvalk
Copy link
Author

I'm closing this as the proposed workaround works well enough.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type:enhancement enhance or introduce a new feature
Projects
None yet
Development

No branches or pull requests

1 participant