Skip to content

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

PlayfulPiano
Copy link

@PlayfulPiano PlayfulPiano commented Apr 10, 2025

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.

@python-cla-bot
Copy link

python-cla-bot bot commented Apr 10, 2025

All commit authors signed the Contributor License Agreement.

CLA signed

@bedevere-app
Copy link

bedevere-app bot commented Apr 10, 2025

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 skip news label instead.

@PlayfulPiano PlayfulPiano changed the title Add hyperlink to format code information for strftime() and strptime() docstrings. gh-132375: Add hyperlink to format code information for strftime() and strptime() docstrings. Apr 10, 2025
@StanFromIreland
Copy link
Contributor

StanFromIreland commented Apr 10, 2025

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.

Copy link
Contributor

@StanFromIreland StanFromIreland left a 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/...

@PlayfulPiano
Copy link
Author

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.

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/

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/...

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?

@PlayfulPiano PlayfulPiano changed the title gh-132375: Add hyperlink to format code information for strftime() and strptime() docstrings. gh-97517: Add hyperlink to format code information for strftime() and strptime() docstrings. Apr 10, 2025
Copy link
Member

@ZeroIntensity ZeroIntensity left a 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.

@StanFromIreland
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants