Skip to content

Commit 8f90cc1

Browse files
committed
Merge branch 'main' into optional-context
2 parents 5d60a5d + e799cc6 commit 8f90cc1

15 files changed

+129
-37
lines changed

.github/workflows/cache_data.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
- name: Install the package
4747
run: |
4848
python -m build --sdist
49-
pip install dist/*
49+
python -m pip install dist/*
5050
5151
# Download remote files
5252
- name: Download remote data

.github/workflows/ci_docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ jobs:
100100
- name: Install the package
101101
run: |
102102
python -m build --sdist
103-
pip install dist/*
103+
python -m pip install dist/*
104104
105105
# Build the documentation
106106
- name: Build the documentation

.github/workflows/ci_doctests.yaml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# This workflow installs PyGMT and runs all doctests
2+
3+
name: Doctests
4+
5+
on:
6+
# push:
7+
# branches: [ main ]
8+
# pull_request:
9+
# Schedule weekly tests on Sunday
10+
schedule:
11+
- cron: '0 0 * * 0'
12+
13+
jobs:
14+
test:
15+
name: ${{ matrix.os }}
16+
runs-on: ${{ matrix.os }}
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
os: [ubuntu-latest, macOS-latest, windows-latest]
21+
timeout-minutes: 30
22+
defaults:
23+
run:
24+
shell: bash -l {0}
25+
26+
steps:
27+
# Cancel previous runs that are not completed
28+
- name: Cancel Previous Runs
29+
uses: styfle/[email protected]
30+
with:
31+
access_token: ${{ github.token }}
32+
33+
# Checkout current git repository
34+
- name: Checkout
35+
uses: actions/[email protected]
36+
with:
37+
# fetch all history so that setuptools-scm works
38+
fetch-depth: 0
39+
40+
# Install Mambaforge with conda-forge dependencies
41+
- name: Setup Mambaforge
42+
uses: conda-incubator/[email protected]
43+
with:
44+
activate-environment: pygmt
45+
python-version: '3.11'
46+
channels: conda-forge,nodefaults
47+
channel-priority: strict
48+
miniforge-version: latest
49+
miniforge-variant: Mambaforge
50+
mamba-version: "*"
51+
run-post: false
52+
use-mamba: true
53+
54+
# Install GMT and other required dependencies from conda-forge
55+
- name: Install dependencies
56+
run: |
57+
mamba install gmt=6.4.0 numpy \
58+
pandas xarray netCDF4 packaging \
59+
build make 'pytest>=6.0' \
60+
pytest-cov pytest-doctestplus pytest-mpl sphinx-gallery \
61+
contextily geopandas ipython rioxarray
62+
63+
# Show installed pkg information for postmortem diagnostic
64+
- name: List installed packages
65+
run: mamba list
66+
67+
# Download cached remote files (artifacts) from GitHub
68+
- name: Download remote data from GitHub
69+
uses: dawidd6/[email protected]
70+
with:
71+
workflow: cache_data.yaml
72+
workflow_conclusion: success
73+
name: gmt-cache
74+
path: .gmt
75+
76+
# Move downloaded files to ~/.gmt directory and list them
77+
- name: Move and list downloaded remote files
78+
run: |
79+
mkdir -p ~/.gmt
80+
mv .gmt/* ~/.gmt
81+
# Change modification times of the two files, so GMT won't refresh it
82+
touch ~/.gmt/server/gmt_data_server.txt ~/.gmt/server/gmt_hash_server.txt
83+
ls -lhR ~/.gmt
84+
85+
# Install the package that we want to test
86+
- name: Install the package
87+
run: make install
88+
89+
# Run the doctests
90+
- name: Run doctests
91+
run: make doctest PYTEST_EXTRA="-r P"

.github/workflows/ci_tests.yaml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,8 @@ jobs:
130130

131131
# Run the regular tests
132132
- name: Run tests
133-
if: ${{ !endsWith(github.event.schedule, '3') }}
134133
run: make test PYTEST_EXTRA="-r P"
135134

136-
# Run full tests including doctests on Wednesday
137-
- name: Run full tests
138-
if: github.event_name == 'schedule' && endsWith(github.event.schedule, '3')
139-
run: make fulltest PYTEST_EXTRA="-r P"
140-
141135
# Upload diff images on test failure
142136
- name: Upload diff images if any test fails
143137
uses: actions/upload-artifact@v3
@@ -148,7 +142,7 @@ jobs:
148142

149143
# Upload coverage to Codecov
150144
- name: Upload coverage to Codecov
151-
uses: codecov/[email protected].1
145+
uses: codecov/[email protected].2
152146
with:
153147
file: ./coverage.xml # optional
154148
env_vars: OS,PYTHON,NUMPY

.github/workflows/ci_tests_dev.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ jobs:
7171
fetch-depth: 0
7272

7373
- name: Show job URL
74-
uses: peter-evans/create-or-update-comment@v2.1.1
74+
uses: peter-evans/create-or-update-comment@v3.0.0
7575
if: github.event_name == 'repository_dispatch' && (matrix.os == 'ubuntu-latest')
7676
with:
7777
token: ${{ steps.generate-token.outputs.token }}
@@ -99,7 +99,7 @@ jobs:
9999
mamba install python=${{ matrix.python-version }} \
100100
ninja cmake libblas libcblas liblapack fftw libgdal \
101101
geopandas ghostscript libnetcdf hdf5 zlib curl pcre make
102-
pip install --pre --prefer-binary \
102+
python -m pip install --pre --prefer-binary \
103103
numpy pandas xarray netCDF4 packaging \
104104
build contextily dvc ipython rioxarray \
105105
'pytest>=6.0' pytest-cov pytest-doctestplus pytest-mpl \

.github/workflows/dvc-diff.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,14 @@ jobs:
102102

103103
- name: Create comment with image diff report
104104
if: steps.fc.outputs.comment-id == ''
105-
uses: peter-evans/create-or-update-comment@v2.1.1
105+
uses: peter-evans/create-or-update-comment@v3.0.0
106106
with:
107107
issue-number: ${{ github.event.pull_request.number }}
108108
body: ${{ steps.image-diff.outputs.report }}
109109

110110
- name: Update comment with new image diff report
111111
if: steps.fc.outputs.comment-id != ''
112-
uses: peter-evans/create-or-update-comment@v2.1.1
112+
uses: peter-evans/create-or-update-comment@v3.0.0
113113
with:
114114
comment-id: ${{ steps.fc.outputs.comment-id }}
115115
body: ${{ steps.image-diff.outputs.report }}

.github/workflows/format-command.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
# Install formatting tools
2929
- name: Install formatting tools
3030
run: |
31-
pip install black blackdoc docformatter==1.5.1 flakeheaven isort
31+
python -m pip install black blackdoc docformatter==1.5.1 flakeheaven isort
3232
sudo apt-get install dos2unix
3333
3434
# Run "make format" and commit the change to the PR branch
@@ -45,7 +45,7 @@ jobs:
4545
fi
4646
4747
- name: Add reaction
48-
uses: peter-evans/create-or-update-comment@v2.1.1
48+
uses: peter-evans/create-or-update-comment@v3.0.0
4949
with:
5050
token: ${{ steps.generate-token.outputs.token }}
5151
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}

.github/workflows/style_checks.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626

2727
- name: Install packages
2828
run: |
29-
pip install black blackdoc docformatter==1.5.1 flakeheaven pylint isort
29+
python -m pip install black blackdoc docformatter==1.5.1 flakeheaven pylint isort
3030
sudo apt-get install dos2unix
3131
3232
- name: Formatting check (black, blackdoc, docformatter, flakeheaven and isort)

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ help:
2323
@echo ""
2424

2525
install:
26-
pip install --no-deps -e .
26+
python -m pip install --no-deps -e .
2727

2828
package:
2929
python -m build

doc/contributing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ To install the current source code into your testing environment, run:
227227

228228
```bash
229229
make install # on Linux/macOS
230-
pip install --no-deps -e . # on Windows
230+
python -m pip install --no-deps -e . # on Windows
231231
```
232232

233233
This installs your project in *editable* mode, meaning that changes made to the source

doc/install.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,17 +218,17 @@ Using pip
218218
This installs the latest stable release from
219219
`PyPI <https://pypi.org/project/pygmt>`__::
220220

221-
pip install pygmt
221+
python -m pip install pygmt
222222

223223
.. tip::
224224

225-
You can also run ``pip install pygmt[all]`` to install pygmt with
225+
You can also run ``python -m pip install pygmt[all]`` to install pygmt with
226226
all of its optional dependencies.
227227

228228
Alternatively, you can install the latest development version from
229229
`TestPyPI <https://test.pypi.org/project/pygmt>`__::
230230

231-
pip install --pre --extra-index-url https://test.pypi.org/simple/ pygmt
231+
python -m pip install --pre --extra-index-url https://test.pypi.org/simple/ pygmt
232232

233233
To upgrade the installed stable release or development version to be the latest
234234
one, just add ``--upgrade`` to the corresponding command above.

doc/maintenance.md

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,7 @@ There are 11 configuration files located in `.github/workflows`:
7979
2. `ci_tests.yaml` (Tests on Linux/macOS/Windows)
8080

8181
This is run on every commit to the *main* and pull request branches.
82-
It is also scheduled to run regular tests daily and run full tests
83-
(including doctests) on Wednesday on the *main* branch.
82+
It is also scheduled to run regular tests daily on the *main* branch.
8483
In draft pull requests, only two jobs on Linux are triggered to save on
8584
Continuous Integration resources:
8685

@@ -93,7 +92,12 @@ There are 11 configuration files located in `.github/workflows`:
9392
via the [Codecov GitHub Action](https://github.com/codecov/codecov-action).
9493
More codecov related configurations are stored in `.github/codecov.yml`.
9594

96-
3. `ci_docs.yml` (Build documentation on Linux/macOS/Windows)
95+
3. `ci_doctests.yaml` (Doctests on Linux/macOS/Windows)
96+
97+
This workflow is scheduled to run all doctests every Sunday on the *main*
98+
branch.
99+
100+
4. `ci_docs.yml` (Build documentation on Linux/macOS/Windows)
97101

98102
This is run on every commit to the *main* and pull request branches.
99103
In draft pull requests, only the job on Linux is triggered to save on
@@ -106,47 +110,47 @@ There are 11 configuration files located in `.github/workflows`:
106110
from the *main* branch onto the `dev` folder of the *gh-pages* branch.
107111
* Updating the `latest` documentation link to the new release.
108112

109-
4. `ci_tests_dev.yaml` (GMT Dev Tests on Linux/macOS/Windows).
113+
5. `ci_tests_dev.yaml` (GMT Dev Tests on Linux/macOS/Windows).
110114

111115
This is triggered when a PR is marked as "ready for review", or using the
112116
slash command `/test-gmt-dev`. It is also scheduled to run on Monday,
113117
Wednesday and Friday on the *main* branch.
114118

115-
5. `cache_data.yaml` (Caches GMT remote data files needed for GitHub Actions CI)
119+
6. `cache_data.yaml` (Caches GMT remote data files needed for GitHub Actions CI)
116120

117121
This is scheduled to run every Sunday at 12:00 (UTC).
118122
If new remote files are needed urgently, maintainers can manually uncomment
119123
the 'pull_request:' line in that `cache_data.yaml` file to refresh the cache.
120124

121-
6. `publish-to-pypi.yml` (Publish wheels to TestPyPI and PyPI)
125+
7. `publish-to-pypi.yml` (Publish wheels to TestPyPI and PyPI)
122126

123127
This workflow is ran to publish wheels to TestPyPI (for testing only) and
124128
PyPI. Archives will be pushed to TestPyPI on every commit to the *main*
125129
branch and tagged releases, and to PyPI for tagged releases only. Note that
126130
authentication to TestPyPI/PyPI is done via OpenID Connect, see also
127131
https://github.com/pypa/gh-action-pypi-publish/tree/release/v1#publishing-with-openid-connect
128132

129-
7. `release-drafter.yml` (Drafts the next release notes)
133+
8. `release-drafter.yml` (Drafts the next release notes)
130134

131135
This workflow is run to update the next releases notes as pull requests are
132-
merged into the main branch.
136+
merged into the *main* branch.
133137

134-
8. `check-links.yml` (Check links in the repository and website)
138+
9. `check-links.yml` (Check links in the repository and website)
135139

136140
This workflow is run weekly to check all external links in plaintext and
137141
HTML files. It will create an issue if broken links are found.
138142

139-
9. `format-command.yml` (Format the codes using slash command)
143+
10. `format-command.yml` (Format the codes using slash command)
140144

141145
This workflow is triggered in a PR if the slash command `/format` is used.
142146

143-
10. `dvc-diff.yml` (Report changes to test images on dvc remote)
147+
11. `dvc-diff.yml` (Report changes to test images on dvc remote)
144148

145149
This workflow is triggered in a PR when any *.png.dvc files have been added,
146150
modified, or deleted. A GitHub comment will be published that contains a summary
147151
table of the images that have changed along with a visual report.
148152

149-
11. `release-baseline-images.yml` (Upload the ZIP archive of baseline images as a release asset)
153+
12. `release-baseline-images.yml` (Upload the ZIP archive of baseline images as a release asset)
150154

151155
This workflow is run to upload the ZIP archive of baseline images as a release
152156
asset when a release is published.

pygmt/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,8 @@ def _get_ghostscript_version():
165165
"packaging",
166166
"contextily",
167167
"geopandas",
168+
"IPython",
169+
"rioxarray",
168170
]
169171

170172
print("PyGMT information:", file=file)

pygmt/datasets/tile_map.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def load_tile_map(region, zoom="auto", source=None, lonlat=True, wait=0, max_ret
8787
ImportError
8888
If ``contextily`` is not installed or can't be imported. Follow
8989
:doc:`install instructions for contextily <contextily:index>`, (e.g.
90-
via ``pip install contextily``) before using this function.
90+
via ``python -m pip install contextily``) before using this function.
9191
9292
Examples
9393
--------
@@ -111,7 +111,7 @@ def load_tile_map(region, zoom="auto", source=None, lonlat=True, wait=0, max_ret
111111
if contextily is None:
112112
raise ImportError(
113113
"Package `contextily` is required to be installed to use this function. "
114-
"Please use `pip install contextily` or "
114+
"Please use `python -m pip install contextily` or "
115115
"`mamba install -c conda-forge contextily` "
116116
"to install the package."
117117
)

pygmt/src/tilemap.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,15 @@ def tilemap(
115115
ImportError
116116
If ``rioxarray`` is not installed. Follow
117117
:doc:`install instructions for rioxarray <rioxarray:installation>`,
118-
(e.g. via ``pip install rioxarray``) before using this function.
118+
(e.g. via ``python -m pip install rioxarray``) before using this
119+
function.
119120
"""
120121
kwargs = self._preprocess(**kwargs) # pylint: disable=protected-access
121122

122123
if rioxarray is None:
123124
raise ImportError(
124125
"Package `rioxarray` is required to be installed to use this function. "
125-
"Please use `pip install rioxarray` or "
126+
"Please use `python -m pip install rioxarray` or "
126127
"`mamba install -c conda-forge rioxarray` "
127128
"to install the package."
128129
)

0 commit comments

Comments
 (0)