Skip to content
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

Use sphinx-astropy xref aliases #11684

Merged
merged 5 commits into from
Jun 23, 2021

Conversation

nstarman
Copy link
Member

@nstarman nstarman commented May 2, 2021

"Upstream" much of the numpydoc xref to sphinx-astropy for use by affiliate packages.

Blocked by: astropy/sphinx-astropy#40

@adrn @mhvk

Tests:

  • Open this PR and have a circular / not-circular dependency. Does it error? NOPE πŸ₯³
  • If ↑ works, then try allowing astropy's conf.py to use the sphinx_astropy v1 duplicate definitions. Does this use the tested astropy version ?
  • If ↑ works, make this a real PR. πŸš€

@github-actions
Copy link

github-actions bot commented May 2, 2021

πŸ‘‹ Thank you for your draft pull request! Do you know that you can use [ci skip] or [skip ci] in your commit messages to skip running continuous integration tests until you are ready?

@adrn
Copy link
Member

adrn commented May 2, 2021

My instigation, because I asked about https://github.com/astropy/sphinx-astropy/pull/40/files#r624715168

Does this lead to any weird circular dependency issues?

πŸ˜„

@nstarman
Copy link
Member Author

nstarman commented May 2, 2021

Hmm. This step appears to be a bit trickier. There's some intersphinx subtleties since the intersphinx_mapping in sphinx_astropy.sphinx refers to astropy, but this is astropy stable, and we want the intersphinx to refer to the version being built.

@pllim @embray , git blame says y'all last modified the line

del intersphinx_mapping['astropy']  # noqa: F405

Any suggestions how to intersphinx to the version being built? Is that even possible? Larger question, is this even a good idea, or should we just keep the physical type xref explicitly in Astropy/docs/conf.py (in addition to in sphinx_astropy v1 for affiliate packages)?

Edit : astropy/sphinx-astropy#15 is relevant.

@pllim
Copy link
Member

pllim commented May 3, 2021

Any suggestions how to intersphinx to the version being built?

Maybe #11622 is what you need?

p.s. We don't really have enough resources for big changes to sphinx-astropy.

@nstarman
Copy link
Member Author

nstarman commented May 3, 2021

Maybe #11622 is what you need?

Looks like it. It helped me figure out the solution. Thanks!

p.s. We don't really have enough resources for big changes to sphinx-astropy.

Understood. I'm working with @adrn to enable some of the numpydoc xref to be easily used by affiliate packages. I'm trying to avoid messing with any intersphinx magic, just moving some dictionaries around. Probably nothing big.

@nstarman
Copy link
Member Author

nstarman commented May 3, 2021

@adrn @mhvk. This works! We can move much of the numpydoc xref stuff from Astropy to sphinx-astropy, thereby allowing affiliate packages to use the xref. I've set it up so that sphinx-astropy creates affiliate links, so here in astropy we just strip the intersphinx parts from the links with two quick .replace() string operations.

There are two things before I undraft:

  1. How much should be moved to sphinx-astropy?
  2. The sphinx-astropy PR needs to be merged first (intersphinx xrefΒ sphinx-astropy#40)

@nstarman
Copy link
Member Author

nstarman commented May 4, 2021

I think #11690 can be lightly modified (once merged) to skip the need for the intersphinx stripping happening in this PR. That would make astropy_sphinx "just" work for both affiliate and astropy.

@nstarman nstarman marked this pull request as ready for review May 18, 2021 17:33
@mhvk
Copy link
Contributor

mhvk commented May 18, 2021

@nstarman - this looks nice, but obviously still needs the astropy-sphinx PR to be merged first...

@nstarman nstarman changed the title Test circularity in sphinx_astropy importing astropy Use sphinx_astropy xref aliases May 25, 2021
@nstarman nstarman changed the title Use sphinx_astropy xref aliases Use sphinx-astropy xref aliases May 25, 2021
@nstarman nstarman force-pushed the tst_circular_astropy_sphinx branch from 48769d2 to a5dd1f0 Compare May 25, 2021 00:37
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>
@nstarman nstarman force-pushed the tst_circular_astropy_sphinx branch from a5dd1f0 to 0832b9d Compare May 27, 2021 02:00
@nstarman
Copy link
Member Author

astropy-sphinx PR to be merged first

Unfortunately, a new release... No chance that sphinx-astropy could release in lock-step with Astropy (if there's a change in sphinx-astropy) ?

@pllim
Copy link
Member

pllim commented Jun 21, 2021

chance that sphinx-astropy could release in lock-step with Astropy

Right now, release is done as needed and when people have time. I won't have time this week.

@nstarman nstarman force-pushed the tst_circular_astropy_sphinx branch from 82c9f66 to 7aa5d56 Compare June 22, 2021 22:14
@nstarman
Copy link
Member Author

nstarman commented Jun 22, 2021

Request review: @pllim @saimn @astrofrog @adrn @mhvk

@mhvk @adrn. Failures unrelated?

@pllim
Copy link
Member

pllim commented Jun 23, 2021

32-bit/parallel failure is due to #11878 .

I am not sure if I can review this PR. I have not been following the doc stuff closely.

@nstarman
Copy link
Member Author

32-bit/parallel failure is due to #11878 .

Thanks! I was worried there.

I am not sure if I can review this PR.

NP. I tagged because of astropy/sphinx-astropy#40.

Copy link
Contributor

@mhvk mhvk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@mhvk
Copy link
Contributor

mhvk commented Jun 23, 2021

I think this is just ready to go in, as it was a logical follow-up of the sphinx astropy update. But maybe leave open for a day in case others want to have a look.

@nstarman
Copy link
Member Author

reminder to self: really need to do #11584 to also document which x-refs are in sphinx-astropy, how an affiliate package should use all this (also add documentation in sphinx-astropy), and how to add a term to sphinx-astropy and remove in astropy (if present).

@saimn saimn added Docs and removed installation labels Jun 23, 2021
@saimn saimn added this to the v5.0 milestone Jun 23, 2021
Copy link
Contributor

@saimn saimn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. I put the milestone to 5.0 but maybe we could backport to avoid conflicts in case we need to update the conf.py file in the future.

@@ -0,0 +1 @@
Use ``sphinx-astropy`` for ``numpydoc`` xref settings.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this deserves a changelog entry, it's an internal change not visible by users.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

pllim
pllim previously requested changes Jun 23, 2021
Copy link
Member

@pllim pllim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As @saimn said, please remove change log.

p.s. @Cadair , does your towncrier check logic not set failure if "no changelog entry needed" label is there but there is a changelog entry?

Signed-off-by: Nathaniel Starkman (@nstarman) <nstarkman@protonmail.com>
Signed-off-by: Nathaniel Starkman (@nstarman) <nstarkman@protonmail.com>
@nstarman nstarman force-pushed the tst_circular_astropy_sphinx branch from 7aa5d56 to ca39402 Compare June 23, 2021 15:40
@pllim pllim dismissed their stale review June 23, 2021 15:42

Addressed

@saimn saimn merged commit 9fa8272 into astropy:main Jun 23, 2021
@saimn
Copy link
Contributor

saimn commented Jun 23, 2021

Thanks @nstarman !

@nstarman nstarman deleted the tst_circular_astropy_sphinx branch June 23, 2021 19:41
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.

None yet

5 participants