-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
gh-97517: Add hyperlink to format code information for strftime() and strptime() docstrings. #132375
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
base: main
Are you sure you want to change the base?
Conversation
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
A recursive link? It is meant to link to an issue, not the same pr :-) In this case there is an existing issue: #97517 You need to sign the CLA, and I would also recommend reading the devguide. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docs strings are not .rst/.md files and are not used to generate them here, you need simpler linking.
e.g.
A list of ...:
https://docs.python.org/3/...
oh my bad, I misread the template text. Was confused why it wanted to use the PR number when you wouldn't have access to it until after making the PR. I did sign the CLA though. Unsure why it didn't update. https://cla.python.org/view/80712991-7cd2-4933-8b47-2db40d5596e4/
Huh. I was searching for the clickable hyperlink format for a python docstring and it said to use the pr's syntax. It worked fine when I made the same edits locally when viewing it under VSCode's documentation method tooltip. Would the syntax you mentioned allow link clicking too? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We generally don't use Sphinx markup like this in docstrings, because help()
can't render it. I'm not 100% sure what the best way to deal with this is.
Note that this PR looks like it's trying to do the same thing as #31761.
In that PR we came to the conclusion it should be a link and the PR owner has not updated the PR for quite a while so this is fine. As for the markup please just make it a simple link like I mentioned before. |
Fairly self-explanatory PR. Whenever I've used the datetime library, I've commonly had to open up the format code documentation in my web browser. This is just an inclusion of a link to the official python documentation so end users can more quickly/easily access this information. Plus it synergizes well with documentation extensions like VSCode's Docs View.
It might be worthwhile to port the full format code documentation, but I figured this would be a nice QoL addition without concern about how the documentation should be structured in the docstring.