Skip to content

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

Open

Description

@maxrjones

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

Activity

  1. added
    documentation
    feature request
    on Feb 13, 2021
  2. maxrjones commented on Feb 13, 2021

    @maxrjones
    MemberAuthor

    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.

  3. weiji14 commented on Feb 13, 2021

    @weiji14
    Member

    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.

  4. removed
    feature request
    on Feb 17, 2021
  5. willschlitzer commented on Dec 24, 2021

    @willschlitzer
    Contributor

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

  6. maxrjones commented on Dec 27, 2021

    @maxrjones
    MemberAuthor

    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.

  7. added this to the 0.6.1 milestone on Mar 18, 2022
  8. modified the milestones: 0.6.1, 0.7.0 on Apr 9, 2022
  9. modified the milestones: 0.7.0, 0.8.0 on Jun 23, 2022
  10. modified the milestones: 0.8.0, 0.9.0 on Dec 11, 2022
  11. modified the milestones: 0.9.0, 0.10.0 on Mar 19, 2023
  12. removed this from the 0.10.0 milestone on Aug 24, 2023
  13. yvonnefroehlich commented on Nov 26, 2023

    @yvonnefroehlich
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions