-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Plot directive: delegate file handling to Sphinx #24205
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
Conversation
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.
Thank you for opening your first PR into Matplotlib!
If you have not heard from us in a while, please feel free to ping @matplotlib/developers
or anyone who has commented on the PR. Most of our reviewers are volunteers and sometimes things fall through the cracks.
You can also join us on gitter for real-time discussion.
For details on testing, writing docs, and our review process, please see the developer guide
We strive to be a welcoming and open project. Please follow our Code of Conduct.
Sorry, something went wrong.
All reactions
I think this is going to move some files around in the final build. Do we expect that is going to cause trouble for anyone? |
All reactions
Sorry, something went wrong.
Yes. Moreover, the paths will be unpredictable (they are generated by hashing file contents). I've already expressed this concern in #24005. However, at least the docs built for this PR look fine (I don't see any obvious problems). If somebody has a deeper understanding of Sphinx API, maybe an alternative solution can be found. Keep in mind, although, that it must:
|
All reactions
Sorry, something went wrong.
@MikhailRyazanov Thanks for looking into this. Unfortunately, we might lack sphinx expertise to properly understand and solve this issue. - I have to admit, that the download-approach feels a bit hackish, but I don't have a better suggestion. So it might be that we'll have trouble coming up with a decision here.
While this all is reasonable would be nice, we do not necessarily need a 100% solution. Maybe that makes solving some parts easier. We could decide that |
All reactions
Sorry, something went wrong.
@timhoffm, IMHO hackish is how this extension currently circumvents Sphinx mechanisms by copying files directly to the output tree (at a wrong build phase) and trying to generate links to them (based on incorrect assumptions). I would say that Basically, what do you think is wrong with using Regarding |
All reactions
Sorry, something went wrong.
All reactions
Sorry, something went wrong.
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.
Weakly in favor of taking this. Fixing singlehtml
worth the risk of changed URLs.
Sorry, something went wrong.
All reactions
@tacaswell, thanks for approving this!
As I wrote, it at least lets Sphinx itself to handle all the file management and thus avoid all the mentioned problems (when unneeded files are copied, needed files are not copied, and wrong links are generated). The only “hackish” thing about it is that formally
According to Sphinx documentation, there is “Phase 1: Reading”, when the doctree is prepared and cached on the disk (to
The visual appearance is entirely controlled by the selected Sphinx theme (through CSS). Matplotlib docs use |
All reactions
Sorry, something went wrong.
@story645 thanks for pinging. However, I don’t feel competent to review this topic and I don’t have the time to dig into this. |
All reactions
-
👍 1 reaction
Sorry, something went wrong.
Looks like this needs a rebase now. |
All reactions
Sorry, something went wrong.
3e625e9
to
d9a3c2b
Compare
OK, “rebased” and updated the tests introduced in PR #24215. No idea why the AppVeyor test is shown as failed, with cryptic messages ”Canceling since a higher priority waiting request for 'Tests-24205-' exists” / “More recent PR #24205 build has been started.” Should it be restarted manually? |
All reactions
Sorry, something went wrong.
Thanks @MikhailRyazanov! Congratulations on your first PR to Matplotlib 🎉 We hope to hear from you again. |
All reactions
Sorry, something went wrong.
Thanks @QuLogic! Will it be released in 3.7.0 or 3.6.3? (And when this can be expected?) |
All reactions
Sorry, something went wrong.
github-actions[bot]
tacaswell
QuLogic
Successfully merging this pull request may close these issues.
None yet
PR Summary
This PR solves multiple problems with file handling in
matplotlib.sphinxext.plot_directive
described in issue #24005 (and #13858) by delegating all files copying and links generation to the Sphinx:download:
role instead of trying to do so explicitly (which apparently cannot be done properly with the current approach).PR Checklist
Tests and Styling
pytest
passes).flake8-docstrings
and runflake8 --docstring-convention=all
).Documentation
doc/users/next_whats_new/
(follow instructions in README.rst there).doc/api/next_api_changes/
(follow instructions in README.rst there).