Skip to content

Commit 79c879e

Browse files
seismanleouieda
authored andcommitted
Build GMT master instead of using conda-forge (#261)
The conda-forge development package creates all sorts of problems for us with mixtures of different channels, etc. It's a hassle to setup and we end up falling behind new features added to GMT 6 (which is what we support). Replace the conda-forge package with GMT built from the master branch on the CI services. Update the install instructions to tell users to build GMT from source.
1 parent 1079460 commit 79c879e

File tree

9 files changed

+77
-84
lines changed

9 files changed

+77
-84
lines changed

.travis.yml

Lines changed: 46 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ language: generic
66
# Use the container builds so we don't need sudo priviledges
77
sudo: false
88

9+
cache:
10+
directories:
11+
- gmt-master/build
12+
913
# Only build pushes to the master branch and tags. This avoids the double
1014
# builds than happen when working on a branch instead of a fork.
1115
branches:
@@ -14,6 +18,34 @@ branches:
1418
# Regex to build tagged commits with version numbers
1519
- /\d+\.\d+(\.\d+)?(\S*)?$/
1620

21+
# Set the Ubuntu version for the Linux builds
22+
dist: xenial
23+
24+
# GMT dependencies for the Linux and OSX builds
25+
addons:
26+
apt:
27+
packages:
28+
- cmake
29+
- build-essential
30+
- libcurl4-gnutls-dev
31+
- libnetcdf-dev
32+
- libgdal1-dev
33+
- libfftw3-dev
34+
- libpcre3-dev
35+
- liblapack-dev
36+
- ghostscript
37+
- curl
38+
homebrew:
39+
packages:
40+
- cmake
41+
- curl
42+
- netcdf
43+
- gdal
44+
- fftw
45+
- pcre2
46+
- ghostscript
47+
- curl
48+
1749
# Define environment variables common to all builds
1850
env:
1951
global:
@@ -23,12 +55,15 @@ env:
2355
# TWINE_PASSWORD to deploy to PyPI
2456
- secure: "md4fgPt9RC/sCoN5//5PcNHLUd9gWQGewV5hFpWW88MRTjxTng1Zfs8r7SqlF2AkEEepFfyzq0BEe9c3FMAnFbec3KmqdlQen4V8xDbLrcTlvkPlTrYGbAScUvdhhqojB//hMHoTD4KvxAv9CiUwFBO4hCMmj2buWHUbV9Ksu5WCW9mF/gkt/hIuYAU6Mbwt8PiYyMgUpzMHO1vruofcWRaVnvKwmBqHB0ae86D4/drpwn4CWjlM12WUnphT2bssiyPkw24FZtCN6kPVta6bLZKBxu0bZpw2vbXuUG+Yh19Q4mp8wNYT3XSHJf8Hl5LfujF48+cLWu+6rlCkdcelyVylhWLFc3rGOONAv4G8jWW2yNSz/bLQfJnMpd81fQEu5eySmFxB7mdB0uyKpvIG1jMJQ73LlYKakKLAPdYhMFyQAHoX9gvCE3S4QR95DBMi5gM/pZubOCcMLdjPHB5JKpJHSjxbOzyVwgmsUIEgd5Bi2vZvvYQXn1plk4xpQ3PhXc+/gi33bzY89mKcfOn0HJ2pD1vLqDXRCBsMCakoLZ0JB/6bacaz4FngbsGWuQ+I1cz20lJGL/MSi9bW1G7Uoidt3GXXWDmXrWt70vIXlLIxr8XV0Mu/rPbauGgWE+ZSYEfvdM5sP+FNF7vQ5de+Fkvzg5Z3tTfR+O1W+d7+vM4="
2557
- TWINE_USERNAME=Leonardo.Uieda
58+
# Paths for GMT installation
59+
- INSTALLDIR="$HOME/gmt-install-dir"
60+
- COASTLINEDIR="$INSTALLDIR/coast"
61+
- PATH="$INSTALLDIR/bin:$PATH"
62+
- LD_LIBRARY_PATH="$INSTALLDIR/lib:$LD_LIBRARY_PATH"
63+
- GMT_LIBRARY_PATH="$INSTALLDIR/lib"
2664
# The file with the listed requirements to be installed by conda
2765
- CONDA_REQUIREMENTS=requirements.txt
2866
- CONDA_REQUIREMENTS_DEV=requirements-dev.txt
29-
# Get GMT6 from conda-forge development channel
30-
- CONDA_INSTALL_EXTRA="gmt=6.0.0*"
31-
- CONDA_EXTRA_CHANNEL=conda-forge/label/dev
3267
# These variables control which actions are performed in a build
3368
- TEST=false
3469
- CHECK=false
@@ -44,8 +79,7 @@ matrix:
4479
env:
4580
- PYTHON=3.6
4681
- CHECK=true
47-
# Don't need to install everything just to run the style checks
48-
- CONDA_INSTALL_EXTRA="black flake8 pylint"
82+
- CONDA_INSTALL_EXTRA="black flake8 pylint=2.2.2"
4983
- CONDA_REQUIREMENTS=""
5084
- CONDA_REQUIREMENTS_DEV=""
5185
- name: "Linux - Python 3.7"
@@ -54,14 +88,15 @@ matrix:
5488
- PYTHON=3.7
5589
- TEST=true
5690
- BUILD_DOCS=true
57-
- name: "Linux - Python 3.6 (also deploys)"
91+
- name: "Linux - Python 3.6 (deploy)"
5892
os: linux
5993
env:
6094
- PYTHON=3.6
6195
- TEST=true
6296
- BUILD_DOCS=true
6397
- DEPLOY_DOCS=true
6498
- DEPLOY_PYPI=true
99+
- CONDA_INSTALL_EXTRA="twine"
65100
- name: "Mac - Python 3.7"
66101
os: osx
67102
env:
@@ -76,6 +111,11 @@ matrix:
76111
- BUILD_DOCS=true
77112

78113
before_install:
114+
# Build and install GMT from the master branch
115+
- if [ "$TEST" == "true" ]; then
116+
bash helpers/build-gmt-master.sh;
117+
fi
118+
- cd "$TRAVIS_BUILD_DIR"
79119
# Get the Fatiando CI scripts
80120
- git clone https://github.com/fatiando/continuous-integration.git
81121
# Download and install miniconda and setup dependencies

doc/install.rst

Lines changed: 12 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Installing
55

66
.. note::
77

8-
**This package is in early stages of development.**
8+
🚨 **This package is in early stages of design and implementation.** 🚨
99

1010
We welcome any feedback and ideas!
1111
Let us know by submitting
@@ -29,23 +29,14 @@ doesn't interfere with any other Python installations in your system.
2929
Which GMT?
3030
----------
3131

32-
You'll need GMT 6, the latest development version available from
32+
You'll need the latest development version available from
3333
`the GitHub repository <https://github.com/GenericMappingTools/gmt>`__.
34+
GMT/Python is based on GMT 6, **which has not yet been officially released**.
3435

35-
We need the very latest GMT since there are many changes being made to the C API in
36+
We need the very latest GMT since there are many changes being made to GMT itself in
3637
response to the development of GMT/Python, mainly the new
3738
`modern execution mode <http://gmt.soest.hawaii.edu/projects/gmt/wiki/Modernization>`__.
3839

39-
**GMT 6 has not been officially released** yet.
40-
However, we provide compiled conda packages of the development version for Linux and Mac
41-
through `conda-forge <https://github.com/conda-forge/gmt-feedstock/>`__.
42-
You can also
43-
`build GMT from source <http://gmt.soest.hawaii.edu/projects/gmt/wiki/BuildingGMT>`__
44-
instead,
45-
which is untested and we would love to get feedback from anyone who tries.
46-
47-
We recommend following the instructions further on to install GMT 6.
48-
4940

5041
Dependencies
5142
------------
@@ -62,44 +53,18 @@ The following are optional (but recommended) dependencies:
6253
* `IPython <https://ipython.org/>`__: For embedding the figures in Jupyter notebooks.
6354

6455

65-
Installing GMT and other dependencies
66-
-------------------------------------
67-
68-
Before installing GMT/Python, we must install GMT itself along with the other
69-
dependencies.
70-
The easiest way to do this is using the ``conda`` package manager.
71-
We recommend working in an isolated
72-
`conda environment <https://conda.io/docs/user-guide/tasks/manage-environments.html>`__
73-
to avoid issues with competing versions of GMT and its dependencies.
74-
75-
First, we must configure conda to get packages from the
76-
`conda-forge channel <https://conda-forge.org/>`__ (the order is important)::
77-
78-
conda config --prepend channels conda-forge/label/dev
79-
conda config --prepend channels conda-forge
56+
Installing GMT
57+
--------------
8058

81-
Now we can create a new conda environment with Python and all our dependencies installed
82-
(we'll call it ``gmt-python`` but you can change it to whatever you want)::
83-
84-
conda create --name gmt-python python=3.6 pip numpy pandas xarray packaging ipython gmt=6.0.0*
85-
86-
Activate the environment by running::
87-
88-
source activate gmt-python
89-
90-
From now on, all commands will take place inside the environment and won't affect your
91-
default installation.
59+
Unfortunately, you'll have to build GMT from source in order to get GMT/Python working.
60+
Please follow the instructions at http://gmt.soest.hawaii.edu/projects/gmt/wiki/BuildingGMT
9261

9362
.. note::
9463

95-
**Currently, this only works on Linux and macOS.**
96-
97-
We don't have a GMT conda package for Windows
98-
(`we're working on it <https://github.com/conda-forge/gmt-feedstock>`__).
99-
If you know how to
100-
build GMT from source, you can do that instead of the ``conda install
101-
gmt``. This is untested and we would love to get feedback from anyone who
102-
tries.
64+
We used to maintain conda packages for the latest GMT. That caused many problems and
65+
was very difficult to maintain updated. We have opted to not do that anymore so that
66+
we can develop more quickly. Once GMT 6 is officially released, we'll have conda
67+
packages available again. Please bear with us.
10368

10469

10570
Installing GMT/Python

environment.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
name: gmt-python
22
channels:
33
- conda-forge
4-
- conda-forge/label/dev
54
dependencies:
65
- python=3.6
76
- pip
8-
- gmt=6.0.0*
97
- numpy
108
- pandas
119
- xarray
@@ -25,4 +23,3 @@ dependencies:
2523
- sphinx_rtd_theme
2624
- nbsphinx
2725
- numpydoc
28-
- twine

gmt/base_plotting.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -445,12 +445,6 @@ def basemap(self, **kwargs):
445445
{J}
446446
{R}
447447
{B}
448-
D : str
449-
``'[unit]xmin/xmax/ymin/ymax[r][+sfile][+t]'``
450-
Draw a simple map insert box on the map. Requires *F*.
451-
F : bool or str
452-
Without further options, draws a rectangular border around any map
453-
insert (*D*), map scale (*L*) or map rose (*T*).
454448
L : str
455449
``'[g|j|J|n|x]refpoint'``
456450
Draws a simple map scale centered on the reference point specified.
@@ -466,8 +460,6 @@ def basemap(self, **kwargs):
466460
kwargs = self._preprocess(**kwargs)
467461
if not ("B" in kwargs or "L" in kwargs or "T" in kwargs):
468462
raise GMTInvalidInput("At least one of B, L, or T must be specified.")
469-
if "D" in kwargs and "F" not in kwargs:
470-
raise GMTInvalidInput("Option D requires F to be specified as well.")
471463
with Session() as lib:
472464
lib.call_module("basemap", build_arg_string(kwargs))
473465

gmt/tests/baseline/test_basemap_d.png

-17.4 KB
Binary file not shown.

gmt/tests/test_basemap.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,6 @@ def test_basemap_required_args():
1414
fig.basemap(R="10/70/-3/8", J="X4i/3i")
1515

1616

17-
@pytest.mark.mpl_image_compare
18-
def test_basemap_d():
19-
"Make sure the D option works"
20-
fig = Figure()
21-
fig.basemap(R="10/70/-300/800", J="X3i/5i", B="af", D="30/35/-200/500", F=True)
22-
return fig
23-
24-
25-
def test_basemap_d_raises():
26-
"Make sure the D raises an error when F not given."
27-
fig = Figure()
28-
with pytest.raises(GMTInvalidInput):
29-
fig.basemap(R="10/70/-300/800", J="X3i/5i", B="af", D="30/35/-200/500")
30-
31-
3217
@pytest.mark.mpl_image_compare
3318
def test_basemap():
3419
"Create a simple basemap plot"

gmt/tests/test_figure.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def test_figure_region_country_codes():
4848
def test_figure_savefig_exists():
4949
"Make sure the saved figure has the right name"
5050
fig = Figure()
51-
fig.basemap(region="10/70/-300/800", J="X3i/5i", B="af", D="30/35/-200/500", F=True)
51+
fig.basemap(region="10/70/-300/800", J="X3i/5i", B="af")
5252
prefix = "test_figure_savefig_exists"
5353
for fmt in "png pdf jpg bmp eps tif".split():
5454
fname = ".".join([prefix, fmt])
@@ -60,7 +60,7 @@ def test_figure_savefig_exists():
6060
def test_figure_savefig_transparent():
6161
"Check if fails when transparency is not supported"
6262
fig = Figure()
63-
fig.basemap(region="10/70/-300/800", J="X3i/5i", B="af", D="30/35/-200/500", F=True)
63+
fig.basemap(region="10/70/-300/800", J="X3i/5i", B="af")
6464
prefix = "test_figure_savefig_transparent"
6565
for fmt in "pdf jpg bmp eps tif".split():
6666
fname = ".".join([prefix, fmt])
@@ -112,6 +112,6 @@ def mock_psconvert(*args, **kwargs): # pylint: disable=unused-argument
112112
def test_figure_show():
113113
"Test that show creates the correct file name and deletes the temp dir"
114114
fig = Figure()
115-
fig.basemap(R="10/70/-300/800", J="X3i/5i", B="af", D="30/35/-200/500", F=True)
115+
fig.basemap(R="10/70/-300/800", J="X3i/5i", B="af")
116116
img = fig.show(width=800)
117117
assert img.width == 800

helpers/build-gmt-master.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
# Download and build the GMT master branch. Used by TravisCI.
3+
4+
set -e
5+
6+
mkdir -p "$INSTALLDIR"
7+
mkdir -p "$COASTLINEDIR"
8+
git clone --depth=1 --branch=master https://github.com/GenericMappingTools/gmt.git tmp
9+
mkdir -p gmt-master
10+
cp -r tmp/* gmt-master
11+
rm -rf tmp
12+
cd gmt-master
13+
bash ci/download-coastlines.sh
14+
TEST=false bash ci/build-gmt.sh
15+
16+
set +e

requirements-dev.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,5 @@ sphinx
1313
sphinx_rtd_theme
1414
nbsphinx
1515
numpydoc
16-
twine
1716
# The following are installed for checking possible conflicts
1817
basemap
19-

0 commit comments

Comments
 (0)