Skip to content

Document conventions for ordering aliases and arguments in contributing.md #884

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

Open
maxrjones opened this issue Feb 13, 2021 · 5 comments
Labels
documentation Improvements or additions to documentation

Comments

@maxrjones
Copy link
Member

Description of the desired feature

Most of the PyGMT modules order aliases and arguments alphabetically by the GMT short option. I think it would be helpful to add this convention (if it is decided) to the contributing guidelines under example code standards.

Are you willing to help implement and maintain this feature? Yes

@maxrjones maxrjones added documentation Improvements or additions to documentation feature request New feature wanted labels Feb 13, 2021
@maxrjones
Copy link
Member Author

I did not find a conversation that settled on this convention in a quick search of past issues (apologies if I missed this). While alphabetically by short option is easily readable for the aliases section of the docs, I actually think that it makes it hard to find things in the parameters section. I would find it easier to read the docs if parameters was alphabetically by alias/long-option.

@weiji14
Copy link
Member

weiji14 commented Feb 13, 2021

I did not find a conversation that settled on this convention in a quick search of past issues (apologies if I missed this).

Yes, things are a bit inconsistent, and I don't think we've spelt this out in any previous issue, so thanks for raising this to our attention!

While alphabetically by short option is easily readable for the aliases section of the docs

Agree on this, I think the code line at

for arg in sorted(module_func.aliases):
sorts things under the "Aliases:" section.

... I actually think that it makes it hard to find things in the parameters section. I would find it easier to read the docs if parameters was alphabetically by alias/long-option.

We can discuss a bit more about sorting alphabetically. A couple of points to consider:

  • Required arguments should come first (e.g. x/y/z in pygmt.surface shouldn't be placed near the end).
  • There are some modules where we use common_options (those with {V}, {XY}, {c}, {p}, {t} etc). These are usually not so important arguments. How do we want to sort those? Keep them at the end or sort them alphabetically in line with the rest? E.g. colorbar:
    {V}
    {XY}
    {c}
    {p}
    {t}

Of course, it's hard for someone starting out to know what is 'important' or not (i.e. very subjective). So maybe we can find a balance somehow so that new users can jump in without having to familiarize themselves too much with the GMT world.

@willschlitzer
Copy link
Contributor

Should we add a separate section in contributing.md about writing the docstrings for a module (where this ordering convention would go)?

@maxrjones
Copy link
Member Author

Should we add a separate section in contributing.md about writing the docstrings for a module (where this ordering convention would go)?

I'm part-way through adding a section with general instructions for wrapping a module (https://github.com/GenericMappingTools/pygmt/commits/wrap-module-instructions). That would be a good place to put the convention, but I will not include them in the PR from that branch so that any necessary discussion could happen separately.

@seisman seisman added this to the 0.6.1 milestone Mar 18, 2022
@seisman seisman modified the milestones: 0.6.1, 0.7.0 Apr 9, 2022
@seisman seisman modified the milestones: 0.7.0, 0.8.0 Jun 23, 2022
@seisman seisman modified the milestones: 0.8.0, 0.9.0 Dec 11, 2022
@seisman seisman modified the milestones: 0.9.0, 0.10.0 Mar 19, 2023
@weiji14 weiji14 removed this from the 0.10.0 milestone Aug 24, 2023
@yvonnefroehlich
Copy link
Member

I think the list of aliases is mainly relevant for PyGMT users coming from GMT. To easily find the alias corresponding to a single letter, an alphabetical order is helpful.

About the order within the parameter section, I have to think in more detail. So far, I would say the required parameters should be listed at the beginning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

5 participants