Skip to content

Doc: sg section separator #25021

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

Merged
merged 3 commits into from
Jan 19, 2023
Merged

Doc: sg section separator #25021

merged 3 commits into from
Jan 19, 2023

Conversation

tacaswell
Copy link
Member

PR Summary

Prompted by #25016 this changes all of our SG section separators to # %% and documents that this is our preference.

displayed, and figures are put into the built page.
displayed, and figures are put into the built page. Matplotlib uses the
``# %%`` section separator so that IDEs will identify "code cells" to make
it easy to re-run sub-sections of the example.
Copy link
Member

@rcomer rcomer Jan 18, 2023

Choose a reason for hiding this comment

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

There is an example of a tutorial below this which still has the long line. Edit: and the description right above it talks about a line of #.

Copy link
Member Author

Choose a reason for hiding this comment

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

🤦🏻 I looked for our documentation on how to split sections and was a bit surprised we did not have any. I am glad the problem was me and not our docs! Thank you for catching this.

Copy link
Member

Choose a reason for hiding this comment

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

what about adding a subsection heading at L814 "Formatting Examples" - it seems redundant in prose, but might be useful in the right hand side navigation

Copy link
Member

@jklymak jklymak left a comment

Choose a reason for hiding this comment

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

I think this is fine, but I don't think we should merge until we discuss and make sure everyone is onboard with the change. So I'm just blocking until a few more people weight in with up or down thumbs or checkmarks.

My only objection is that I find it less readable, but it's not terrible.

@story645
Copy link
Member

My only objection is that I find it less readable, but it's not terrible.

I'm 👍 because this separator is far harder to mess up than the very long line of hashes where I'm never quite sure how many. (Yes, I mark 80 in vs code and go to that line, but I don't know if that's a thing in other editors). Also, like @tacaswell and @kolibril13 mentioned, it makes blockwise execution trivial in a bunch of IDEs and that rapid iteration is super useful.

displayed, and figures are put into the built page.
displayed, and figures are put into the built page. Matplotlib uses the
``# %%`` section separator so that IDEs will identify "code cells" to make
it easy to re-run sub-sections of the example.
Copy link
Member

Choose a reason for hiding this comment

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

what about adding a subsection heading at L814 "Formatting Examples" - it seems redundant in prose, but might be useful in the right hand side navigation

This is so that IDEs will auto detect "cells" and make (re) running sub
sections of the code easier for development and debugging.
@QuLogic
Copy link
Member

QuLogic commented Jan 19, 2023

Going to ignore the Azure pipeline, as it timed out there, but didn't post the result ot GitHub, so I can't even restart it. Plus this is all docs.

@QuLogic QuLogic merged commit 9c48e4b into matplotlib:main Jan 19, 2023
@tacaswell tacaswell deleted the doc/sg_splitter branch January 19, 2023 21:38
rcomer pushed a commit to rcomer/matplotlib that referenced this pull request Feb 14, 2023
…rom examples

Manual backport of matplotlib#25198 due to conflicts in
examples/subplots_axes_and_figures/demo_constrained_layout.py
This was because some of the changes here were right below the section
separators which changed in main at matplotlib#25021.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants