Skip to content

Conversation

@seisman
Copy link
Member

@seisman seisman commented Apr 4, 2021

Description of proposed changes

For non-dev versions, __version__ is a string like v0.3.1, without commit hashes. In this case, we should set __commit__ to "".

When __commit__ is empty, the "Revision xxx" in the documentation footer won't show, so this PR also fixes #1171.

Reminders

  • Run make format and make check to make sure the code follows the style guide.
  • Add tests for new features or tests that would have caught the bug that you're fixing.
  • Add new public functions/methods/classes to doc/api/index.rst.
  • Write detailed docstrings for all functions/methods.
  • If adding new functionality, add an example to docstrings or tutorials.

Slash Commands

You can write slash commands (/command) in the first line of a comment to perform
specific operations. Supported slash commands are:

  • /format: automatically format and lint the code
  • /test-gmt-dev: run full tests on the latest GMT development version

@seisman seisman requested a review from weiji14 April 4, 2021 18:08
@seisman seisman added the maintenance Boring but important stuff for the core devs label Apr 4, 2021
@seisman seisman added this to the 0.4.0 milestone Apr 4, 2021
@weiji14 weiji14 added the skip-changelog Skip adding Pull Request to changelog label Apr 5, 2021
@seisman seisman requested a review from weiji14 April 5, 2021 03:48
@seisman
Copy link
Member Author

seisman commented Apr 5, 2021

/format

doc/conf.py Outdated
f'<a href="{repository_url}/commit/{ __commit__ }">{ __commit__[:8] }</a>'
)
else:
commit_link = ""
Copy link
Member

Choose a reason for hiding this comment

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

Since we have this if-else block, could we be smart and point to the tag on GitHub?

Copy link
Member

@weiji14 weiji14 Apr 5, 2021

Choose a reason for hiding this comment

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

We'll need to detect whether the commit string is a hash like a1b2c4d4 or a version tag like v0.X.Y, but the idea is to have something like so (note, don't commit yet as it won't work):

Suggested change
commit_link = ""
commit_link = f'<a href="{repository_url}/tree/{ __commit__ }">{ __commit__}</a>'

which would e.g. point to https://github.com/GenericMappingTools/pygmt/tree/v0.3.1

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 was thinking about it too. It's OK to point to the specific tag, but the text would be "Revision v0.3.1", not "Release v0.3.1".

Copy link
Member

Choose a reason for hiding this comment

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

"Revision v0.3.1" doesn't sound too bad actually (though it's not perfect either).

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Does this need to be backported to the gh-pages branch?

Copy link
Member Author

Choose a reason for hiding this comment

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

Perhaps do the backport together with #1151, as mentioned in #1150 (comment).

Copy link
Member

Choose a reason for hiding this comment

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

Ok, sounds like a good plan.

@seisman seisman requested a review from weiji14 April 5, 2021 04:16
@seisman seisman merged commit d105c72 into master Apr 5, 2021
@seisman seisman deleted the fix-doc-commit branch April 5, 2021 04:47
sixy6e pushed a commit to sixy6e/pygmt that referenced this pull request Dec 21, 2022
…gTools#1174)

* Set __commit__ to an empty string for non-dev releases
* Link to tags for non-dev releases

Co-authored-by: actions-bot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance Boring but important stuff for the core devs skip-changelog Skip adding Pull Request to changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Broken link to the commit hash in the latest documentation

4 participants