Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

DOC: Suppress IPython output in examples and tutorials where not needed#23978

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
tacaswell merged 1 commit intomatplotlib:mainfromStefRe:DOC/no-capture
Sep 23, 2022

Conversation

StefRe
Copy link
Contributor

PR Summary

By default, sphinx-gallery captures the last output of each code block and shows it in the generated html in yellow boxes. Especially in tutorials with frequently interleaving code and text blocks this may appear confusing and reduces readability. In some cases, however, the output is desired (although it could always be replaced by printing).

The global configuration is now changed to "capture nothing", for one tutorial with multiple desired outputs this is overridden in the file to show the output and in other cases with just one desired output it's converted to a call to print().

(I went through all the examples and tutorials by searching the generated rst files for.. rst-class:: sphx-glr-script-out to see if we need the generated output, hopefully I didn't overlook some desired output)

This PR addresses this#21794 (comment):

I won't object if someone has a way to suppress these via configuration. However, note that some of our examples want the output to show up, so it can't be global.

PR Checklist

Tests and Styling

  • [N/A] Has pytest style unit tests (andpytest passes).
  • [N/A] IsFlake 8 compliant (installflake8-docstrings and runflake8 --docstring-convention=all).

Documentation

  • [N/A] New features are documented, with examples if plot related.
  • [N/A] New features have an entry indoc/users/next_whats_new/ (follow instructions in README.rst there).
  • [N/A] API changes documented indoc/api/next_api_changes/ (follow instructions in README.rst there).
  • Documentation is sphinx and numpydoc compliant (the docs shouldbuild without error).

By default, sphinx-gallery captures the last output of each code blockand shows it in the generated html in yellow boxes. Especially intutorials with a frequently interleaving code and text blocks this mayappear confusing and reduces readability. In some cases, however, theoutput is desired (although it could always be replaced by printing).The global configuration is now changed to "capture nothing", for onetutorial with multiple desired outputs this is overridden in the fileto show the output and in other cases with just one desired outputit's converted to a call to print().
@tacaswelltacaswell added this to thev3.7.0 milestoneSep 21, 2022
@tacaswell
Copy link
Member

I am very surprised that we only had ~2 cases where the output was valuable and intentials.

I'm inclined to merge but not back port this so we have a while for any issues to be found in the devdocs.

@StefRe
Copy link
ContributorAuthor

StefRe commentedSep 21, 2022
edited
Loading

I am very surprised that we only had ~2 cases where the output was valuable and intentials.

Me too - if I had known earlier I wouldn't have madesphinx-gallery/sphinx-gallery#891. It turned out, however, that practically in all cases, where the output is intentional, it was already produced byprint (or by error messages). The remaining cases were ~95 %Line2D,Legend orText.

@timhoffm
Copy link
Member

I'm also surprised, but this

I turned out, however, that practically in all cases, where the output is intentional, it was already produced by print (or by error messages)

makes sense.

I'm inclined to merge but not back port this so we have a while for any issues to be found in the devdocs.

Do we read the devdocs so thoroughly that we would find possible issues? While I do a lot of docs stuff, I would not claim for me that I would find a significant fraction of such issues if they existed. I therefore would be happy to backport.

story645 reacted with thumbs up emoji

@tacaswelltacaswell modified the milestones:v3.7.0,v3.6.1Sep 22, 2022
@tacaswelltacaswell merged commit269c0b9 intomatplotlib:mainSep 23, 2022
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull requestSep 23, 2022
@StefReStefRe deleted the DOC/no-capture branchSeptember 23, 2022 07:01
timhoffm added a commit that referenced this pull requestSep 23, 2022
…978-on-v3.6.xBackport PR#23978 on branch v3.6.x (DOC: Suppress IPython output in examples and tutorials where not needed)
@ksundenksunden mentioned this pull requestFeb 20, 2023
6 tasks
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@tacaswelltacaswelltacaswell approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
v3.6.1
Development

Successfully merging this pull request may close these issues.

3 participants
@StefRe@tacaswell@timhoffm

[8]ページ先頭

©2009-2025 Movatter.jp