Skip to content

DOC: Update internal links for generator.rst and related#26378

Merged
charris merged 1 commit intonumpy:mainfrom
bmwoodruff:links-generator-rst
May 5, 2024
Merged

DOC: Update internal links for generator.rst and related#26378
charris merged 1 commit intonumpy:mainfrom
bmwoodruff:links-generator-rst

Conversation

@bmwoodruff
Copy link
Member

This is a first in a sequence of future PRs to update internal links, as discussed in the triage meeting. In addition to removing double backticks on internal functions, I removed unneeded tilde ~ as well. This is a great example page to see why a tilde ~ is needed in the first paragraph of generator.rst.

I included instructions for the POSSEE team on this topic, as it's a simple way to help train them in the PR process.

I did build the docs, and verify that each link appropriately points to the correct spot. If there is any thing I can do to help speed up the review process as more of these come in, let me know.

[skip azp] [skip actions] [skip cirrus]

This is a first in a sequence of future PRs to update internal links, as discussed in the triage meeting.
In addition to removing double backticks on internal functions, I removed unneeded tilde ~ as well.
This is a great example page to see why a tilde ~ is needed in the first paragraph of generator.rst.

I included instructions for the POSSEE team on this topic, as its a simple way to help train them in the PR process.

[skip azp] [skip actions] [skip cirrus]
@charris
Copy link
Member

charris commented May 4, 2024

It might be helpful to make a document about linking, together with some examples of right and wrong :)

@bmwoodruff
Copy link
Member Author

@charris Any suggestions on where to add it? Where you thinking to the numpy site, or just the POSSEE project?

The Sphinx docs has a referencing page that is quite helpful. It's general though and numpy's configuration file enables some things that aren't on that page. It does explain how the ~ works. The numpydocs instructions related to internal links are quite sparse. Maybe that would be a good place to add the examples.

I wrote up a short description for the POSSEE project that has a few examples I could add to the numpydocs page (I added them below). Thoughts?

``default_rng`` #appears as monospace. Should be avoided for numpy functions
`default_rng` #creates internal link to default_rng, of which the only one is numpy.random.default_rng
`~default_rng` #same as above, the tilde isn't needed
`numpy.random.default_rng` #creates internal link to numpy.random.default_rng
`~numpy.random.default_rng` #creates internal link to numpy.random.default_rng, but the link text is default_rng

I've seen other examples in the docs that include a ~ along with various other things (for example ~.default_rng, ~random.default_rng). Maybe the inconsistency is fine and the best approach is to just leave the longer versions that work. The hard part comes into play when a new method is created such as integers which requires ~Generator.integers to appropriately link it, or another such as random for which there are many options and you must include the tilde to get ~Generator.integers.

@charris charris merged commit a83d469 into numpy:main May 5, 2024
@charris
Copy link
Member

charris commented May 5, 2024

Thanks Ben. Because you have verified the docs, I don't have a problem putting this in.

As to where to put the information on linking, numpydoc is probably the best spot. Is it safe to say ~numpy.random.default_rng, with and without the tilde, will always work, but that there are more concise ways to get the same result? I'm thinking "when in doubt ...".

@charris charris added the 09 - Backport-Candidate PRs tagged should be backported label May 8, 2024
@charris charris removed the 09 - Backport-Candidate PRs tagged should be backported label May 8, 2024
@bmwoodruff bmwoodruff deleted the links-generator-rst branch May 15, 2024 23:42
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.

2 participants