GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fmt_docstrings: Use string template syntax for docstring placeholders and support curly braces in docstrings by seisman · Pull Request #4210 · GenericMappingTools/pygmt

Conversation

@seisman

@seisman seisman commented Nov 15, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Description of proposed changes

See #3815 for the original issue report and the solution.

This PR uses the string.Template method to avoid using curly braces for docstring placeholders.

Changes in this PR include:

  • Update docstring placeholder syntax from {projection} to $projection
  • Rename placeholder table-classes to table_classes because string.Template doesn't work well with -
  • Replace {{/}} with {/} in LaTeX math equations

Fixes #3815.

Preview:

Wrappers with math equations:

  • https://pygmt-dev--4210.org.readthedocs.build/en/4210/api/generated/pygmt.Figure.colorbar.html
  • https://pygmt-dev--4210.org.readthedocs.build/en/4210/api/generated/pygmt.Figure.meca.html
  • https://pygmt-dev--4210.org.readthedocs.build/en/4210/api/generated/pygmt.grdgradient.html
  • https://pygmt-dev--4210.org.readthedocs.build/en/4210/api/generated/pygmt.grdfill.html
  • https://pygmt-dev--4210.org.readthedocs.build/en/4210/api/generated/pygmt.nearneighbor.html
  • https://pygmt-dev--4210.org.readthedocs.build/en/4210/api/generated/pygmt.project.html
  • https://pygmt-dev--4210.org.readthedocs.build/en/4210/api/generated/pygmt.surface.html
  • https://pygmt-dev--4210.org.readthedocs.build/en/4210/api/generated/pygmt.Figure.tilemap.html

An example page with updated docstring placeholder syntax:

  • https://pygmt-dev--4210.org.readthedocs.build/en/4210/api/generated/pygmt.select.html

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@seisman
seisman force-pushed the docstring/placeholder branch 4 times, most recently from c50845b to f44e356 Compare November 15, 2025 09:32
@seisman seisman added the maintenance Boring but important stuff for the core devs label Nov 15, 2025
@seisman seisman modified the milestone: 0.18.0 Nov 15, 2025
@seisman seisman mentioned this pull request Nov 15, 2025
fmt_docstring: Allow raw curly braces {} to avoid KeyError #3815
Closed
@seisman seisman changed the title fmt_docstrings: Support raw curly braces in docstrings WIP: fmt_docstrings: Support raw curly braces in docstrings Nov 15, 2025
seisman added 2 commits November 15, 2025 19:09
@seisman
fmt_docstrings: Use string.Template for docstring placeholders
bb24135
@seisman
Update docstring placeholders to the string.Template syntax
92d14a7
@seisman
seisman force-pushed the docstring/placeholder branch from 03ac916 to 7c1b978 Compare November 15, 2025 11:19
@seisman
Update {aliases} to $aliases and {table-classes} to $table_classes
b428491
@seisman
seisman force-pushed the docstring/placeholder branch 2 times, most recently from 565d256 to f9e1a80 Compare November 15, 2025 11:23
@seisman
Replace {{/}} with {/} in LaTeX math equations
99dd6e8
@seisman
seisman force-pushed the docstring/placeholder branch from f9e1a80 to 99dd6e8 Compare November 15, 2025 11:25
@seisman
grdgradient was incorrectly updated
c6b9661
@seisman seisman changed the title WIP: fmt_docstrings: Support raw curly braces in docstrings fmt_docstrings: Support raw curly braces in docstrings Nov 15, 2025
@seisman seisman changed the title fmt_docstrings: Support raw curly braces in docstrings fmt_docstrings: Use string template syntax for docstring placeholders and support curly braces in docstrings Nov 15, 2025
@seisman seisman added the needs review This PR has higher priority and needs review. label Nov 15, 2025
@seisman
seisman marked this pull request as ready for review November 15, 2025 12:06
yvonnefroehlich
yvonnefroehlich approved these changes Nov 15, 2025
View reviewed changes
seisman added 3 commits November 16, 2025 10:58
@seisman
Merge branch 'main' into docstring/placeholder
1d80d2a
@seisman
Merge branch 'main' into docstring/placeholder
28878a8
@seisman
Merge branch 'main' into docstring/placeholder
0ab92d1
@seisman seisman added final review call This PR requires final review and approval from a second reviewer and removed needs review This PR has higher priority and needs review. labels Nov 23, 2025
@seisman

seisman commented Nov 23, 2025

Copy link
Copy Markdown
Member Author

This is a big change in how the docstrings are written. Hopefully, @weiji14 can give this PR a review.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

seisman added 2 commits November 24, 2025 16:04
@seisman
Merge branch 'main' into docstring/placeholder
2951f30
@seisman
Merge branch 'main' into docstring/placeholder
dca53fd
@seisman
seisman requested a review from weiji14 November 26, 2025 02:00
weiji14
weiji14 approved these changes Nov 26, 2025
View reviewed changes

@weiji14 weiji14 left a comment

Copy link
Copy Markdown
Member

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.

For a second I thought this was using Python 3.14 t-strings, but it is unrelated. LGTM!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@seisman seisman removed the final review call This PR requires final review and approval from a second reviewer label Nov 26, 2025
@seisman
seisman merged commit b4ebdf2 into main Nov 26, 2025
@seisman
seisman deleted the docstring/placeholder branch November 26, 2025 06:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@weiji14 weiji14 weiji14 approved these changes
@yvonnefroehlich yvonnefroehlich yvonnefroehlich approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

maintenance Boring but important stuff for the core devs

Projects

None yet

Milestone

0.18.0

Development

Successfully merging this pull request may close these issues.

fmt_docstring: Allow raw curly braces {} to avoid KeyError

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@seisman @weiji14 @yvonnefroehlich
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.