| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
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.
|
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? |
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:
|
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 singlehtml is not supported by the directive. And/or that multiple targets are not supported and instead must be build with separate calls. |
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 :download: is the correct approach at least for the script files — to compare with, this is what the Sphinx-Gallery extension does (check “Examples” in the Matplotlib docs). And, conceptually, for PDF plots as well (although modern browsers can display PDF files, these are mainly intended for downloading, since SVG is a more appropriate alternative for viewing in a browser). Basically, what do you think is wrong with using :download: for additional files? Except that some other extensions might depend on the files written by plot_directive (this is really hackish, since such behavior is not documented anywhere), although we don't know that any such third-party extensions exist... Regarding singlehtml, not supporting it would be a very strange and unjustified decision, especially since Read the Docs uses it for building downloadable documentation (called “Zipped HTML” there). |
Sorry, something went wrong.
Sorry, something went wrong.
There was a problem hiding this comment.
Weakly in favor of taking this. Fixing singlehtml worth the risk of changed URLs.
Sorry, something went wrong.
|
@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 :download: is intended for files from the source tree rather than from the build directory, but in reality in accepts any paths, so this should not be a problem.
According to Sphinx documentation, there is “Phase 1: Reading”, when the doctree is prepared and cached on the disk (to <build>/plot_directive in our case), and then a separate “Phase 4: Writing”, when all the actual output files are written (plot directive currently ignores this phase and thus could not copy the files when building multiple targets). So the proper way would be either to insert references to the desired files into the doctree and let Sphinx to copy them or, if this can't be done, to add a hook that will copy the necessary files at the writing phase. In either case, this will need better understanding of Sphinx than apparently anybody here has and will result in writing more code than simply using :download:.
The visual appearance is entirely controlled by the selected Sphinx theme (through CSS). Matplotlib docs use mpl-sphinx-theme, inherited from pydata-sphinx-theme, which adds these icons. The default Sphinx theme has no icon and calmer link decorations, and sphinx_rtd_theme has a simpler icon but otherwise no special link formatting. Those who wish the old appearance, in which links to raw files are not distinct from links to normal web pages, can also achieve that easily by a simple custom CSS... |
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. |
Sorry, something went wrong.
|
Looks like this needs a rebase now. |
Sorry, something went wrong.
|
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? |
Sorry, something went wrong.
|
Thanks @MikhailRyazanov! Congratulations on your first PR to Matplotlib 🎉 We hope to hear from you again. |
Sorry, something went wrong.
|
Thanks @QuLogic! Will it be released in 3.7.0 or 3.6.3? (And when this can be expected?) |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
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
Documentation