-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Add support for a Python decorator role #13105
Comments
Just as a note, https://www.sphinx-doc.org/en/master/usage/domains/python.html#directive-py-decorator states
So that should be updated when the role gets implemented. |
@erlend-aasland from the glossary:
So syntactically there's nothing wrong with the existing roles, per se. It was a conservative choice to not further specialize the roles (it would arguably pollute the domain by adding an extra name - if such addition isn't motivated by a clear need and were nothing but an alias). A couple of concerns arise from your original reasoning:
Generally Then @AlexWaygood (an
The inclusion of the ending
But aside from the above point I still fail to see a clear need, going back to your original argument:
Yes those are domain declarations that can require specialized syntax, but the role used in cross-referencing may dispense specialization and I fail to see proof for its clear-cut need (apart from facilitating specialized full-text search). Thus this argument by @CAM-Gerlach hasn't shown any concrete examples supporting it:
@timhoffm have there been previous FRs about this in the repo (that were closed for some reason, or that remain open)? Now would be the time to reexamine previous discussions about this. So is this the only aim?:
This proposes an extra role with the sole purpose of shortening the syntax. Allowing The same result could be obtained by a single Sphinx-wide config that cosmetically prepends the |
Yes, apart from being easy to grep for, my initial thought was syntactic sugar: mark up references to decorators using Now, my Sphinx knowledge is extremely shallow, and I never had the need to experiment with custom roles or directives; this combined with the lack of spare time to set aside for such a pet project lead to my draft PR growing stale pretty quick. |
My love affair with Python is rooted on syntactic sugar. But I'm thinking this kind of FR needs a comparison matrix showing syntactic pros/cons + Sphinx-configs - there are several combined factors at play.
Don't get me wrong, as an experienced Sphinx user I think it's best to be skeptical because many FRs seem nice at first glance but not on further reflection.
Scrutiny&discussion from the wider community is the way to go! I'll try to whoop up that pro/con matrix when I can. |
I don't think there's a risk of pollution, whilst decorators are functions, they're semantically distinct enough for me. Note that we don't just have one 'callable' role, but split into individual types. A |
See previous discussion over at the CPython repo:
typing.dataclass_transform
python/cpython#105792 (comment)The decorator (
:py:deco:
) role would render the function/method reference with a prefixed@
.The text was updated successfully, but these errors were encountered: