Skip to content

Commit b4742fe

Browse files
committed
Merge branch 'master' into newfeature_xyz2grd
2 parents 3cfff68 + 2291371 commit b4742fe

48 files changed

Lines changed: 860 additions & 282 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<!-- Please describe changes proposed and **why** you made them. If unsure, open an issue first so we can discuss.-->
66

7-
<!-- If fixing an issue, put the issue number after the # below (no spaces). Github will automatically close it when this gets merged. -->
7+
<!-- If fixing an issue, put the issue number after the # below (no spaces). GitHub will automatically close it when this gets merged. -->
88
Fixes #
99

1010

@@ -15,3 +15,7 @@ Fixes #
1515
- [ ] Add new public functions/methods/classes to `doc/api/index.rst`.
1616
- [ ] Write detailed docstrings for all functions/methods.
1717
- [ ] If adding new functionality, add an example to docstrings or tutorials.
18+
19+
**Notes**
20+
21+
- You can write `/format` in the first line of a comment to lint the code automatically

.github/workflows/cache_data.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ jobs:
3737
@tut_bathy.nc @tut_quakes.ngdc @tut_ship.xyz \
3838
@usgs_quakes_22.txt
3939
40-
# Upload the downloaded files as artifacts to Github
41-
- name: Upload artifacts to Github
40+
# Upload the downloaded files as artifacts to GitHub
41+
- name: Upload artifacts to GitHub
4242
uses: actions/upload-artifact@v2
4343
with:
4444
name: gmt-cache

.github/workflows/ci_tests.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
python-version: 3.7
2929

3030
- name: Install packages
31-
run: pip install black flake8 pylint
31+
run: pip install black blackdoc flake8 pylint
3232

3333
- name: Formatting check (black and flake8)
3434
run: make check
@@ -89,8 +89,8 @@ jobs:
8989
shell: bash -l {0}
9090
run: conda list
9191

92-
# Download cached remote files (artifacts) from Github
93-
- name: Download remote data from Github
92+
# Download cached remote files (artifacts) from GitHub
93+
- name: Download remote data from GitHub
9494
uses: dawidd6/action-download-artifact@v2.6.3
9595
with:
9696
workflow: cache_data.yaml

.github/workflows/ci_tests_dev.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
matrix:
2222
python-version: [3.8]
2323
os: [ubuntu-20.04, macOS-10.15]
24-
gmt_git_ref: [6.1, master]
24+
gmt_git_ref: [master]
2525
env:
2626
# LD_LIBRARY_PATH: ${{ github.workspace }}/gmt/lib:$LD_LIBRARY_PATH
2727
GMT_INSTALL_DIR: ${{ github.workspace }}/gmt-install-dir
@@ -61,8 +61,8 @@ jobs:
6161
env:
6262
GMT_GIT_REF: ${{ matrix.gmt_git_ref }}
6363

64-
# Download cached remote files (artifacts) from Github
65-
- name: Download remote data from Github
64+
# Download cached remote files (artifacts) from GitHub
65+
- name: Download remote data from GitHub
6666
uses: dawidd6/action-download-artifact@v2.6.3
6767
with:
6868
workflow: cache_data.yaml
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: format-command
2+
on:
3+
repository_dispatch:
4+
types: [format-command]
5+
jobs:
6+
format:
7+
runs-on: ubuntu-latest
8+
steps:
9+
# Generate token from GenericMappingTools bot
10+
- uses: tibdex/github-app-token@v1
11+
id: generate-token
12+
with:
13+
app_id: ${{ secrets.APP_ID }}
14+
private_key: ${{ secrets.APP_PRIVATE_KEY }}
15+
16+
# Checkout the pull request branch
17+
- uses: actions/checkout@v2
18+
with:
19+
token: ${{ steps.generate-token.outputs.token }}
20+
repository: ${{ github.event.client_payload.pull_request.head.repo.full_name }}
21+
ref: ${{ github.event.client_payload.pull_request.head.ref }}
22+
23+
# Setup Python environment
24+
- uses: actions/setup-python@v1
25+
26+
# Install formatting tools
27+
- name: Install formatting tools
28+
run: pip install black blackdoc flake8
29+
30+
# Run "make format" and commit the change to the PR branch
31+
- name: Commit to the PR branch if any changes
32+
run: |
33+
make format
34+
if [[ $(git ls-files -m) ]]; then
35+
git config --global user.name 'actions-bot'
36+
git config --global user.email '58130806+actions-bot@users.noreply.github.com'
37+
git commit -am "[format-command] fixes"
38+
git push
39+
fi
40+
41+
- name: Add reaction
42+
uses: peter-evans/create-or-update-comment@v1
43+
with:
44+
token: ${{ steps.generate-token.outputs.token }}
45+
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
46+
comment-id: ${{ github.event.client_payload.github.payload.comment.id }}
47+
reaction-type: hooray
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Slash Command Dispatch
2+
on:
3+
issue_comment:
4+
types: [created]
5+
# Add "edited" type for test purposes. Where possible, avoid using to prevent processing unnecessary events.
6+
# types: [created, edited]
7+
jobs:
8+
slashCommandDispatch:
9+
runs-on: ubuntu-latest
10+
steps:
11+
# Generate token from GenericMappingTools bot
12+
- uses: tibdex/github-app-token@v1
13+
id: generate-token
14+
with:
15+
app_id: ${{ secrets.APP_ID }}
16+
private_key: ${{ secrets.APP_PRIVATE_KEY }}
17+
18+
- name: Slash Command Dispatch
19+
uses: peter-evans/slash-command-dispatch@v2
20+
with:
21+
token: ${{ steps.generate-token.outputs.token }}
22+
commands: |
23+
format
24+
issue-type: pull-request

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ branches:
1818
env:
1919
global:
2020
# Encrypted variables
21-
# Github Token for pushing the built docs (GH_TOKEN)
21+
# GitHub Token for pushing the built docs (GH_TOKEN)
2222
- secure: "QII0477v0mmCCW3qSNXLCOtqraJaCICtSghiyrxYsuUdJTrXzXBNhX2KLIjcKYXOK1HdwYOFGf8xBVLl44clHlAW7R32ecEGeTJizr0yqTBvT3rNG1Xb7+E6jdXqrIs//PmPRaF8zOZxPl1SJKDK4jJpCx5HnAflg7wl/6tQLD6K3/dQ6FG2s3UKsc8o4qchOiEfxYhO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FngbsGWuQ+I1cz20lJGL/MSi9bW1G7Uoidt3GXXWDmXrWt70vIXlLIxr8XV0Mu/rPbauGgWE+ZSYEfvdM5sP+FNF7vQ5de+Fkvzg5Z3tTfR+O1W+d7+vM4="

CONTRIBUTING.md

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ for the project where you can ask questions.
7070

7171
## Reporting a Bug
7272

73-
Find the *Issues* tab on the top of the Github repository and click *New Issue*.
73+
Find the *Issues* tab on the top of the GitHub repository and click *New Issue*.
7474
You'll be prompted to choose between different types of issue, like bug reports and
7575
feature requests.
7676
Choose the one that best matches your need.
@@ -92,7 +92,7 @@ download and install anything:
9292
* On each documentation page, there should be an "Improve This Page" link at the very
9393
top.
9494
* Click on that link to open the respective source file (usually an `.rst` file in the
95-
`doc` folder) on Github for editing online (you'll need a Github account).
95+
`doc` folder) on GitHub for editing online (you'll need a GitHub account).
9696
* Make your desired changes.
9797
* When you're done, scroll to the bottom of the page.
9898
* Fill out the two fields under "Commit changes": the first is a short title describing
@@ -245,8 +245,8 @@ directory).
245245

246246
### Code style
247247

248-
We use [Black](https://github.com/ambv/black) to format the code so we don't have to
249-
think about it.
248+
We use [Black](https://github.com/ambv/black) and [blackdoc](https://github.com/keewis/blackdoc)
249+
to format the code so we don't have to think about it.
250250
Black loosely follows the [PEP8](http://pep8.org) guide but with a few differences.
251251
Regardless, you won't have to worry about formatting the code yourself.
252252
Before committing, run it to automatically format your code:
@@ -255,17 +255,18 @@ Before committing, run it to automatically format your code:
255255
make format
256256
```
257257

258-
Don't worry if you forget to do it.
259-
Our continuous integration systems will warn us and you can make a new commit with the
260-
formatted code.
258+
Don't worry if you forget to do it. Our continuous integration systems will
259+
warn us and you can make a new commit with the formatted code.
260+
Even better, you can just write `/format` in the first line of any comment in a
261+
Pull Request to lint the code automatically.
261262

262263
We also use [flake8](http://flake8.pycqa.org/en/latest/) and
263264
[pylint](https://www.pylint.org/) to check the quality of the code and quickly catch
264265
common errors.
265266
The [`Makefile`](Makefile) contains rules for running both checks:
266267

267268
```bash
268-
make check # Runs flake8 and black (in check mode)
269+
make check # Runs flake8, black and blackdoc (in check mode)
269270
make lint # Runs pylint, which is a bit slower
270271
```
271272

@@ -308,6 +309,14 @@ in your browser. **Strive to get 100% coverage for the lines you changed.**
308309
It's OK if you can't or don't know how to test something.
309310
Leave a comment in the PR and we'll help you out.
310311

312+
You can also run tests in just one test script using:
313+
314+
pytest --verbose --mpl --mpl-results-path=results --doctest_modules pygmt/tests/NAME_OF_TEST_FILE.py
315+
316+
or run tests which contain names that match a specific keyword expression:
317+
318+
pytest --verbose --mpl --mpl-results-path=results --doctest_modules -k KEYWORD pygmt/tests
319+
311320
### Testing plots
312321

313322
Writing an image-based test is only slightly more difficult than a simple test.
@@ -428,7 +437,7 @@ Some things that will increase the chance that your pull request is accepted qui
428437

429438
Pull requests will automatically have tests run by TravisCI.
430439
This includes running both the unit tests as well as code linters.
431-
Github will show the status of these checks on the pull request.
440+
GitHub will show the status of these checks on the pull request.
432441
Try to get them all passing (green).
433442
If you have any trouble, leave a comment in the PR or
434443
[get in touch](#how-can-i-talk-to-you).

MAINTENANCE.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ If you want to make a contribution to the project, see the
1111

1212
* *master*: Always tested and ready to become a new version. Don't push directly to this
1313
branch. Make a new branch and submit a pull request instead.
14-
* *gh-pages*: Holds the HTML documentation and is served by Github. Pages for the master
14+
* *gh-pages*: Holds the HTML documentation and is served by GitHub. Pages for the master
1515
branch are in the `dev` folder. Pages for each release are in their own folders.
1616
**Automatically updated by TravisCI** so you shouldn't have to make commits here.
1717

@@ -40,12 +40,12 @@ The main advantages of this are:
4040

4141
## Continuous Integration
4242

43-
We use Github Actions and TravisCI continuous integration (CI) services to
43+
We use GitHub Actions and TravisCI continuous integration (CI) services to
4444
build and test the project on Linux, macOS and Windows.
4545
They rely on the `requirements.txt` file to install required dependencies using
4646
conda and the `Makefile` to run the tests and checks.
4747

48-
### Github Actions
48+
### GitHub Actions
4949

5050
There are 3 configuration files located in `.github/workflows`:
5151

@@ -59,7 +59,7 @@ It is also scheduled to run daily on the *master* branch.
5959
This is only triggered when a review is requested or re-requested on a PR.
6060
It is also scheduled to run daily on the *master* branch.
6161

62-
3. `cache_data.yaml` (Caches GMT remote data files needed for Github Actions CI)
62+
3. `cache_data.yaml` (Caches GMT remote data files needed for GitHub Actions CI)
6363

6464
This is scheduled to run every Sunday at 12 noon.
6565
If new remote files are needed urgently, maintainers can manually uncomment
@@ -85,7 +85,7 @@ submit pull requests to that repository.
8585

8686
## Continuous Documentation
8787

88-
We use the [Zeit Now for Github integration](https://zeit.co/github) to preview changes
88+
We use the [Zeit Now for GitHub integration](https://zeit.co/github) to preview changes
8989
made to our documentation website every time we make a commit in a pull request.
9090
The integration service has a configuration file `now.json`, with a list of options to
9191
change the default behaviour at https://zeit.co/docs/configuration.
@@ -103,10 +103,10 @@ There are a few steps that still must be done manually, though.
103103

104104
### Updating the changelog
105105

106-
The Release Drafter Github Action will automatically keep a draft changelog at
106+
The Release Drafter GitHub Action will automatically keep a draft changelog at
107107
https://github.com/GenericMappingTools/pygmt/releases, adding a new entry
108108
every time a Pull Request (with a proper label) is merged into the master branch.
109-
This release drafter tool has two configuration files, one for the Github Action
109+
This release drafter tool has two configuration files, one for the GitHub Action
110110
at .github/workflows/release-drafter.yml, and one for the changelog template
111111
at .github/release-drafter.yml. Configuration settings can be found at
112112
https://github.com/release-drafter/release-drafter.
@@ -122,7 +122,7 @@ publishing the actual release notes at https://www.pygmt.org/latest/changes.html
122122

123123
2. Edit the changes list to remove any trivial changes (updates to the README, typo
124124
fixes, CI configuration, etc).
125-
3. Replace the PR number in the commit titles with a link to the Github PR page.
125+
3. Replace the PR number in the commit titles with a link to the GitHub PR page.
126126
Use ``sed -i.bak -E 's$\(#([0-9]*)\)$(`#\1 <https://github.com/GenericMappingTools/pygmt/pull/\1>`__)$g' changes.rst``
127127
to make the change automatically.
128128
4. Copy the remaining changes to `doc/changes.rst` under a new section for the
@@ -142,7 +142,7 @@ publishing the actual release notes at https://www.pygmt.org/latest/changes.html
142142

143143
### Check the README syntax
144144

145-
Github is a bit forgiving when it comes to the RST syntax in the README but PyPI is not.
145+
GitHub is a bit forgiving when it comes to the RST syntax in the README but PyPI is not.
146146
So slightly broken RST can cause the PyPI page to not render the correct content. Check
147147
using the `rst2html.py` script that comes with docutils:
148148

@@ -167,7 +167,7 @@ this new folder.
167167
168168
### Archiving on Zenodo
169169
170-
Grab a zip file from the Github release and upload to Zenodo using the previously
170+
Grab a zip file from the GitHub release and upload to Zenodo using the previously
171171
reserved DOI.
172172
173173
### Updating the conda package

Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ PYTEST_ARGS=--cov=$(PROJECT) --cov-config=../.coveragerc \
66
--doctest-modules -v --mpl --mpl-results-path=results \
77
--pyargs ${PYTEST_EXTRA}
88
BLACK_FILES=$(PROJECT) setup.py doc/conf.py examples
9+
BLACKDOC_OPTIONS=--line-length 79
910
FLAKE8_FILES=$(PROJECT) setup.py doc/conf.py
1011
LINT_FILES=$(PROJECT) setup.py doc/conf.py
1112

@@ -14,8 +15,8 @@ help:
1415
@echo ""
1516
@echo " install install in editable mode"
1617
@echo " test run the test suite (including doctests) and report coverage"
17-
@echo " format run black to automatically format the code"
18-
@echo " check run code style and quality checks (black and flake8)"
18+
@echo " format run black and blackdoc to automatically format the code"
19+
@echo " check run code style and quality checks (black, blackdoc and flake8)"
1920
@echo " lint run pylint for a deeper (and slower) quality check"
2021
@echo " clean clean up build and generated files"
2122
@echo ""
@@ -36,9 +37,11 @@ test:
3637

3738
format:
3839
black $(BLACK_FILES)
40+
blackdoc $(BLACKDOC_OPTIONS) $(BLACK_FILES)
3941

4042
check:
4143
black --check $(BLACK_FILES)
44+
blackdoc --check $(BLACKDOC_OPTIONS) $(BLACK_FILES)
4245
flake8 $(FLAKE8_FILES)
4346

4447
lint:

0 commit comments

Comments
 (0)