diff --git a/.travis.yml b/.travis.yml index ad56ab5c4b2..80bf0f78849 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,10 @@ language: generic # Use the container builds so we don't need sudo priviledges sudo: false +cache: + directories: + - gmt-master/build + # Only build pushes to the master branch and tags. This avoids the double # builds than happen when working on a branch instead of a fork. branches: @@ -14,6 +18,34 @@ branches: # Regex to build tagged commits with version numbers - /\d+\.\d+(\.\d+)?(\S*)?$/ +# Set the Ubuntu version for the Linux builds +dist: xenial + +# GMT dependencies for the Linux and OSX builds +addons: + apt: + packages: + - cmake + - build-essential + - libcurl4-gnutls-dev + - libnetcdf-dev + - libgdal1-dev + - libfftw3-dev + - libpcre3-dev + - liblapack-dev + - ghostscript + - curl + homebrew: + packages: + - cmake + - curl + - netcdf + - gdal + - fftw + - pcre2 + - ghostscript + - curl + # Define environment variables common to all builds env: global: @@ -23,12 +55,15 @@ env: # TWINE_PASSWORD to deploy to PyPI - secure: "md4fgPt9RC/sCoN5//5PcNHLUd9gWQGewV5hFpWW88MRTjxTng1Zfs8r7SqlF2AkEEepFfyzq0BEe9c3FMAnFbec3KmqdlQen4V8xDbLrcTlvkPlTrYGbAScUvdhhqojB//hMHoTD4KvxAv9CiUwFBO4hCMmj2buWHUbV9Ksu5WCW9mF/gkt/hIuYAU6Mbwt8PiYyMgUpzMHO1vruofcWRaVnvKwmBqHB0ae86D4/drpwn4CWjlM12WUnphT2bssiyPkw24FZtCN6kPVta6bLZKBxu0bZpw2vbXuUG+Yh19Q4mp8wNYT3XSHJf8Hl5LfujF48+cLWu+6rlCkdcelyVylhWLFc3rGOONAv4G8jWW2yNSz/bLQfJnMpd81fQEu5eySmFxB7mdB0uyKpvIG1jMJQ73LlYKakKLAPdYhMFyQAHoX9gvCE3S4QR95DBMi5gM/pZubOCcMLdjPHB5JKpJHSjxbOzyVwgmsUIEgd5Bi2vZvvYQXn1plk4xpQ3PhXc+/gi33bzY89mKcfOn0HJ2pD1vLqDXRCBsMCakoLZ0JB/6bacaz4FngbsGWuQ+I1cz20lJGL/MSi9bW1G7Uoidt3GXXWDmXrWt70vIXlLIxr8XV0Mu/rPbauGgWE+ZSYEfvdM5sP+FNF7vQ5de+Fkvzg5Z3tTfR+O1W+d7+vM4=" - TWINE_USERNAME=Leonardo.Uieda + # Paths for GMT installation + - INSTALLDIR="$HOME/gmt-install-dir" + - COASTLINEDIR="$INSTALLDIR/coast" + - PATH="$INSTALLDIR/bin:$PATH" + - LD_LIBRARY_PATH="$INSTALLDIR/lib:$LD_LIBRARY_PATH" + - GMT_LIBRARY_PATH="$INSTALLDIR/lib" # The file with the listed requirements to be installed by conda - CONDA_REQUIREMENTS=requirements.txt - CONDA_REQUIREMENTS_DEV=requirements-dev.txt - # Get GMT6 from conda-forge development channel - - CONDA_INSTALL_EXTRA="gmt=6.0.0*" - - CONDA_EXTRA_CHANNEL=conda-forge/label/dev # These variables control which actions are performed in a build - TEST=false - CHECK=false @@ -44,8 +79,7 @@ matrix: env: - PYTHON=3.6 - CHECK=true - # Don't need to install everything just to run the style checks - - CONDA_INSTALL_EXTRA="black flake8 pylint" + - CONDA_INSTALL_EXTRA="black flake8 pylint=2.2.2" - CONDA_REQUIREMENTS="" - CONDA_REQUIREMENTS_DEV="" - name: "Linux - Python 3.7" @@ -54,7 +88,7 @@ matrix: - PYTHON=3.7 - TEST=true - BUILD_DOCS=true - - name: "Linux - Python 3.6 (also deploys)" + - name: "Linux - Python 3.6 (deploy)" os: linux env: - PYTHON=3.6 @@ -62,6 +96,7 @@ matrix: - BUILD_DOCS=true - DEPLOY_DOCS=true - DEPLOY_PYPI=true + - CONDA_INSTALL_EXTRA="twine" - name: "Mac - Python 3.7" os: osx env: @@ -76,6 +111,11 @@ matrix: - BUILD_DOCS=true before_install: + # Build and install GMT from the master branch + - if [ "$TEST" == "true" ]; then + bash helpers/build-gmt-master.sh; + fi + - cd "$TRAVIS_BUILD_DIR" # Get the Fatiando CI scripts - git clone https://github.com/fatiando/continuous-integration.git # Download and install miniconda and setup dependencies diff --git a/doc/install.rst b/doc/install.rst index 116b4d2586f..d0e95d13105 100644 --- a/doc/install.rst +++ b/doc/install.rst @@ -5,7 +5,7 @@ Installing .. note:: - **This package is in early stages of development.** + 🚨 **This package is in early stages of design and implementation.** 🚨 We welcome any feedback and ideas! Let us know by submitting @@ -29,23 +29,14 @@ doesn't interfere with any other Python installations in your system. Which GMT? ---------- -You'll need GMT 6, the latest development version available from +You'll need the latest development version available from `the GitHub repository `__. +GMT/Python is based on GMT 6, **which has not yet been officially released**. -We need the very latest GMT since there are many changes being made to the C API in +We need the very latest GMT since there are many changes being made to GMT itself in response to the development of GMT/Python, mainly the new `modern execution mode `__. -**GMT 6 has not been officially released** yet. -However, we provide compiled conda packages of the development version for Linux and Mac -through `conda-forge `__. -You can also -`build GMT from source `__ -instead, -which is untested and we would love to get feedback from anyone who tries. - -We recommend following the instructions further on to install GMT 6. - Dependencies ------------ @@ -62,44 +53,18 @@ The following are optional (but recommended) dependencies: * `IPython `__: For embedding the figures in Jupyter notebooks. -Installing GMT and other dependencies -------------------------------------- - -Before installing GMT/Python, we must install GMT itself along with the other -dependencies. -The easiest way to do this is using the ``conda`` package manager. -We recommend working in an isolated -`conda environment `__ -to avoid issues with competing versions of GMT and its dependencies. - -First, we must configure conda to get packages from the -`conda-forge channel `__ (the order is important):: - - conda config --prepend channels conda-forge/label/dev - conda config --prepend channels conda-forge +Installing GMT +-------------- -Now we can create a new conda environment with Python and all our dependencies installed -(we'll call it ``gmt-python`` but you can change it to whatever you want):: - - conda create --name gmt-python python=3.6 pip numpy pandas xarray packaging ipython gmt=6.0.0* - -Activate the environment by running:: - - source activate gmt-python - -From now on, all commands will take place inside the environment and won't affect your -default installation. +Unfortunately, you'll have to build GMT from source in order to get GMT/Python working. +Please follow the instructions at http://gmt.soest.hawaii.edu/projects/gmt/wiki/BuildingGMT .. note:: - **Currently, this only works on Linux and macOS.** - - We don't have a GMT conda package for Windows - (`we're working on it `__). - If you know how to - build GMT from source, you can do that instead of the ``conda install - gmt``. This is untested and we would love to get feedback from anyone who - tries. + We used to maintain conda packages for the latest GMT. That caused many problems and + was very difficult to maintain updated. We have opted to not do that anymore so that + we can develop more quickly. Once GMT 6 is officially released, we'll have conda + packages available again. Please bear with us. Installing GMT/Python diff --git a/environment.yml b/environment.yml index 188df9da4a4..9ef6107d14f 100644 --- a/environment.yml +++ b/environment.yml @@ -1,11 +1,9 @@ name: gmt-python channels: - conda-forge - - conda-forge/label/dev dependencies: - python=3.6 - pip - - gmt=6.0.0* - numpy - pandas - xarray @@ -25,4 +23,3 @@ dependencies: - sphinx_rtd_theme - nbsphinx - numpydoc - - twine diff --git a/gmt/base_plotting.py b/gmt/base_plotting.py index dc3b28d2b6e..58023514a6d 100644 --- a/gmt/base_plotting.py +++ b/gmt/base_plotting.py @@ -445,12 +445,6 @@ def basemap(self, **kwargs): {J} {R} {B} - D : str - ``'[unit]xmin/xmax/ymin/ymax[r][+sfile][+t]'`` - Draw a simple map insert box on the map. Requires *F*. - F : bool or str - Without further options, draws a rectangular border around any map - insert (*D*), map scale (*L*) or map rose (*T*). L : str ``'[g|j|J|n|x]refpoint'`` Draws a simple map scale centered on the reference point specified. @@ -466,8 +460,6 @@ def basemap(self, **kwargs): kwargs = self._preprocess(**kwargs) if not ("B" in kwargs or "L" in kwargs or "T" in kwargs): raise GMTInvalidInput("At least one of B, L, or T must be specified.") - if "D" in kwargs and "F" not in kwargs: - raise GMTInvalidInput("Option D requires F to be specified as well.") with Session() as lib: lib.call_module("basemap", build_arg_string(kwargs)) diff --git a/gmt/tests/baseline/test_basemap_d.png b/gmt/tests/baseline/test_basemap_d.png deleted file mode 100644 index d1921e1c228..00000000000 Binary files a/gmt/tests/baseline/test_basemap_d.png and /dev/null differ diff --git a/gmt/tests/test_basemap.py b/gmt/tests/test_basemap.py index 95ad2a7889e..827aa2b9373 100644 --- a/gmt/tests/test_basemap.py +++ b/gmt/tests/test_basemap.py @@ -14,21 +14,6 @@ def test_basemap_required_args(): fig.basemap(R="10/70/-3/8", J="X4i/3i") -@pytest.mark.mpl_image_compare -def test_basemap_d(): - "Make sure the D option works" - fig = Figure() - fig.basemap(R="10/70/-300/800", J="X3i/5i", B="af", D="30/35/-200/500", F=True) - return fig - - -def test_basemap_d_raises(): - "Make sure the D raises an error when F not given." - fig = Figure() - with pytest.raises(GMTInvalidInput): - fig.basemap(R="10/70/-300/800", J="X3i/5i", B="af", D="30/35/-200/500") - - @pytest.mark.mpl_image_compare def test_basemap(): "Create a simple basemap plot" diff --git a/gmt/tests/test_figure.py b/gmt/tests/test_figure.py index 5f9a7ed89da..86c8a6d7043 100644 --- a/gmt/tests/test_figure.py +++ b/gmt/tests/test_figure.py @@ -48,7 +48,7 @@ def test_figure_region_country_codes(): def test_figure_savefig_exists(): "Make sure the saved figure has the right name" fig = Figure() - fig.basemap(region="10/70/-300/800", J="X3i/5i", B="af", D="30/35/-200/500", F=True) + fig.basemap(region="10/70/-300/800", J="X3i/5i", B="af") prefix = "test_figure_savefig_exists" for fmt in "png pdf jpg bmp eps tif".split(): fname = ".".join([prefix, fmt]) @@ -60,7 +60,7 @@ def test_figure_savefig_exists(): def test_figure_savefig_transparent(): "Check if fails when transparency is not supported" fig = Figure() - fig.basemap(region="10/70/-300/800", J="X3i/5i", B="af", D="30/35/-200/500", F=True) + fig.basemap(region="10/70/-300/800", J="X3i/5i", B="af") prefix = "test_figure_savefig_transparent" for fmt in "pdf jpg bmp eps tif".split(): fname = ".".join([prefix, fmt]) @@ -112,6 +112,6 @@ def mock_psconvert(*args, **kwargs): # pylint: disable=unused-argument def test_figure_show(): "Test that show creates the correct file name and deletes the temp dir" fig = Figure() - fig.basemap(R="10/70/-300/800", J="X3i/5i", B="af", D="30/35/-200/500", F=True) + fig.basemap(R="10/70/-300/800", J="X3i/5i", B="af") img = fig.show(width=800) assert img.width == 800 diff --git a/helpers/build-gmt-master.sh b/helpers/build-gmt-master.sh new file mode 100644 index 00000000000..2fbbba405b0 --- /dev/null +++ b/helpers/build-gmt-master.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# Download and build the GMT master branch. Used by TravisCI. + +set -e + +mkdir -p "$INSTALLDIR" +mkdir -p "$COASTLINEDIR" +git clone --depth=1 --branch=master https://github.com/GenericMappingTools/gmt.git tmp +mkdir -p gmt-master +cp -r tmp/* gmt-master +rm -rf tmp +cd gmt-master +bash ci/download-coastlines.sh +TEST=false bash ci/build-gmt.sh + +set +e diff --git a/requirements-dev.txt b/requirements-dev.txt index c9d77a55cde..1ccd7b0b7a2 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -13,7 +13,5 @@ sphinx sphinx_rtd_theme nbsphinx numpydoc -twine # The following are installed for checking possible conflicts basemap -