xref physical types#11595
Conversation
|
Hello @nstarman 👋! It looks like you've made some changes in your pull request, so I've checked the code again for style. There are no PEP8 style issues with this pull request - thanks! 🎉 Comment last updated at 2021-04-30 15:16:26 UTC |
8bc1524 to
5e01594
Compare
|
@nstarman - I haven't looked in detail yet, but about storage I wonder whether you considered repurposing the way units are represented in the docs, which is basically by automatically generating the docstring for each module (see Regardless, maybe best to do that kind of docs change as a separate PR from using the physical types in the docs? On that: would #10655 enable moving towards allowing |
|
#not_v4.3 |
|
See #11618 for just getting the physical types as a table in the docs. |
|
Great. I'll label this as requiring 11618, and wait until that is merged. This PR will expand upon 11618 to add ReST link targets in the table. |
cca95a2 to
01d41c1
Compare
|
|
8d25e18 to
a5f1e04
Compare
a5f1e04 to
ebd861b
Compare
ebd861b to
1cda3ce
Compare
- Also fix parameter type for angular speed parameters - Add [‘dimensionless’] to altaz’s relative_humidity — from review by @astrofrog Co-authored-by: Adrian Price-Whelan <adrianmpw@gmail.com> Signed-off-by: Nathaniel Starkman (@nstarman) <nstarkman@protonmail.com>
Signed-off-by: Nathaniel Starkman (@nstarman) <nstarkman@protonmail.com>
Signed-off-by: Nathaniel Starkman (@nstarman) <nstarkman@protonmail.com>
Signed-off-by: Nathaniel Starkman (@nstarman) <nstarkman@protonmail.com>
Co-authored-by: Adrian Price-Whelan <adrianmpw@gmail.com> Signed-off-by: Nathaniel Starkman (@nstarman) <nstarkman@protonmail.com>
Co-authored-by: Adrian Price-Whelan <adrianmpw@gmail.com> Signed-off-by: Nathaniel Starkman (@nstarman) <nstarkman@protonmail.com>
Signed-off-by: Nathaniel Starkman (@nstarman) <nstarkman@protonmail.com>
Signed-off-by: Nathaniel Starkman (@nstarman) <nstarkman@protonmail.com>
Signed-off-by: Nathaniel Starkman (@nstarman) <nstarkman@protonmail.com>
Signed-off-by: Nathaniel Starkman (@nstarman) <nstarkman@protonmail.com>
5534afe to
6a7da08
Compare
|
This PR looks great! I can't wait for us to be able to do the same thing for PlasmaPy. |
|
@namurphy your comment makes me wonder: @nstarman are the xref physical types here usable by affiliated packages through intersphinx? Would be good to remember that we should probably document this PR in two places: (1) in the documentation part of the contributing guide (here?) to remind documentation contributions to include physical types when quantities/units are involved, and (2) to guide affiliated package maintainers with how to use xref physical types in their own docs, either through intersphinx or by copy-pasting the relevant part of the |
That's a good question. They should be according to https://docs.readthedocs.io/en/stable/guides/intersphinx.html. One of my goals is to improve the overall ease of intersphinxing with astropy and using the glossary and xref aliases. Part of that goal is to move some of this and other code to
from astropy.units.physical import _units_and_physical_types
numpydoc_xref_physical_type_aliases = {}
for _, ptypes in _units_and_physical_types:
ptypes = {ptypes} if isinstance(ptypes, str) else ptypes
for ptype in ptypes:
key = f"'{ptype}'"
val = f":ref:`:ref: '{ptype}' <astropy:{ptype}>`" # <== intersphinxed link here
numpydoc_xref_physical_type_aliases[key] = val
numpydoc_xref_aliases.update(numpydoc_xref_physical_type_aliases)
👍 #11675 |
Co-authored-by: Adrian Price-Whelan <adrianmpw@gmail.com> Signed-off-by: Nathaniel Starkman (@nstarman) <nstarkman@protonmail.com>
9f03106 to
cc9fd90
Compare
|
@nstarman — thank you! I've got too much pandemic brain fog to think much about it at the moment, but that looks like a good way to go about it for the time being. I'm hoping to look into this more after 4.3 is released. A slight hesitation is that cc: @rocco8773 |
@namurphy, my thought for other packages is to essentially move the short script (if @adrn or others confirm it works) in #11595 (comment) to Alternatively/additionally, a good addition to |
|
@namurphy I think using Edit: As I clicked comment here, I saw @nstarman commented above - yes to what he says! |
|
I think this is ready. Thanks again @nstarman - this is a great addition to the documentation! |
Now that #11118 is in (🥳 ), it's time for followups. One of the more interesting followups came from discussion with @adrn on methods to annotate physical types for Quantity and the like. @namurphy's great #11204 is in and #11606 is done, so I thought I'd give this a go.
See https://astropy--11595.org.readthedocs.build/en/11595/ for the compiled docs.
Part of #11555
Requires :
#11618(done)What this does (edited)
docs/conf.py::numpydoc_xref_aliases.Example
Links to the appropriate row in
And the best part is that the link just looks like
... ['length']!Subpackage review sign-off sheet
@adonath @adamginsburg @StuartLittlefair @astrojuanlu @hamogu @dhomeier @saimn @matteobachetti @eslavich @tboch @tomdonaldson @perrygreenfield @mwcraig
@taldcroft@adrn@mhvk@pllim @bsipocz @eteq @larrybradley @Cadair @astrofrog @mcara @ndenPlease check and add your github handle after an approving review