-
Notifications
You must be signed in to change notification settings - Fork 224
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
How to reproduce original GMT arguments in PyGMT documentation #631
Comments
This is what PEP-257 says:
So, instead of using
|
As pointed out by @weiji14, the PyGMT documentation is inconsistently using italics, bold, and I think we can following these conventions:
This is a good example of what it looks like (https://www.pygmt.org/dev/tutorials/frames.html): |
Ping @GenericMappingTools/python @willschlitzer for thoughts on this. |
@seisman I like this convention for explaining literal titles and the associated arguments that go with them. Are you thinking there should be similar formatting in the string of arguments given in the doctstring? |
Yes, but need feedbacks first. |
Ping @GenericMappingTools/python for comments. |
Ping @GenericMappingTools/python, @GenericMappingTools/python-maintainers and @GenericMappingTools/python-contributors for thoughts on #631 (comment) and #631 (comment). |
Let's go with Option 1 (using the raw string). Easier to copy from GMT, and avoids messy backslashes. Also agree on the backtick Will need to document this (with an example) somewhere in CONTRIBUTING.md |
I think making the entire docstring a raw string is the way to go; I think a double backslash might be confusing to some, and copying directly from GMT makes life easier. I can write this up in CONTRIBUTING.md when we come to a consensus. |
At least three of the maintainers agree with this. I think we can do it now. |
As most of us agree with the new docstring conventions, we should do:
|
When referencing and explaining the written code in documentation, should it all be in
My opinion is to leave it all as |
I think this is the better way. |
I've just been looking through some of the new API docs and noticed a problem. E.g. https://www.pygmt.org/dev/api/generated/pygmt.Figure.coast.html after #765 looks like this: I think we need to add a fullstop/period (.) between |
Anything else remaining after #862? |
Some module-specific arguments still need updates, for example, |
Let me know if you'd like me to help with updating these. |
@meghanrjones Please do! I'm planning on going through the documentation tomorrow; no complaints if you submit a PR for changes! |
Sounds good. I'll try to get it done before then. |
Great! Please try your best to follow the standards as documented here (https://github.com/GenericMappingTools/pygmt/blob/master/CONTRIBUTING.md#example-code-standards). There may be some cases that are not covered by the standards. We can discuss more later. |
Update docstrings in basemap, coast, colorbar, contour, grdcontour, grdimage, grdview, image, inset, legend, logo, plot, plot3d, and text following the convention in #631. Also fixed an unescaped return in decorators.py. Co-authored-by: Dongdong Tian <[email protected]> Co-authored-by: Will Schlitzer <[email protected]> Co-authored-by: Wei Ji <[email protected]>
Is the convention for documenting defaults in PyGMT set? In GMT, it is typically brackets [ ] without any explanation before the default. I remember a comment in which @seisman mentioned that "[Default is ...]" is more clear than just "[...]", but I couldn't find that comment again. |
Yes, it's open for discussions. The GMT documentation sometimes also uses "[Default is ...]". |
Moving forward is seems that the GMT documentation will be going with "[Default is ...]" (see GenericMappingTools/gmt#4834). |
This PR adds links to xarray, pandas, and numpy classes in the Returns section of the docstrings. It also includes a few small fixes according to the conventions set in #631. Co-authored-by: Dongdong Tian <[email protected]>
I think we can document it in the "Example code standards" section, then close the issue, right? |
Yes, I can add that guideline after #1126 is merged. |
Update docstrings in basemap, coast, colorbar, contour, grdcontour, grdimage, grdview, image, inset, legend, logo, plot, plot3d, and text following the convention in GenericMappingTools#631. Also fixed an unescaped return in decorators.py. Co-authored-by: Dongdong Tian <[email protected]> Co-authored-by: Will Schlitzer <[email protected]> Co-authored-by: Wei Ji <[email protected]>
This PR adds links to xarray, pandas, and numpy classes in the Returns section of the docstrings. It also includes a few small fixes according to the conventions set in GenericMappingTools#631. Co-authored-by: Dongdong Tian <[email protected]>
Description of the desired feature
The GMT documentation has many instances where bold and italicized fonts are mixed, looking something like:
The PyGMT documentation has been rather inconsistent with this (see mentions at #525 (comment) and #620 (comment)).
What we should do is to standardize how we want
+n
args
to be written in the documentation. This is a bit complicated, but boils down to (at least) two options:r" **+n**\ *args* "
. Use a raw-string in Python, allowing us to follow upstream GMT (as per Complete documentation of grdimage #620 (comment))" **+n**\\ *args* "
. Use a double-backslash to avoid the flake8 errorW605 invalid escape sequence '\ '
.An alternative would be to find a way to ignore the flake8 error somehow for the ReST docstrings.
Also, should we find a way to put these in code-formatted blocks (i.e. with backticks), as mentioned at https://github.com/GenericMappingTools/pygmt/pull/525/files#r454746311?
Are you willing to help implement and maintain this feature? Somewhat short on time, but will look into it.
References:
The text was updated successfully, but these errors were encountered: