From 3a5fa7d48bb1389351da7d8f8b6f8a8f44db3a90 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Thu, 28 Jan 2021 18:12:28 -0500 Subject: [PATCH 1/6] Fix the comments in requirements.txt and requirements-dev.txt All these packages can be installed via `pip`, so the comments in these two files are not accurate. --- requirements-dev.txt | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index f7ce04e8502..6a3bce9784f 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,4 +1,4 @@ -# Requirements for development using conda +# Optional packages for development black blackdoc coverage[toml] diff --git a/requirements.txt b/requirements.txt index 7d82cb1dd8f..ffdf6724f8e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -# Requirements for installing with conda +# Required packages numpy pandas xarray From 17613f2dda8170c34476c5b7791209157d493d4f Mon Sep 17 00:00:00 2001 From: Wei Ji Date: Mon, 15 Feb 2021 12:09:37 +1300 Subject: [PATCH 2/6] Move dev dependency specification to environment.yml Delete the requirements-dev.txt file, and update the ci_test.yml to install GMT dependencies directly from environment.yml. --- .github/workflows/ci_tests.yaml | 10 +--------- MAINTENANCE.md | 2 +- environment.yml | 3 ++- requirements-dev.txt | 19 ------------------- 4 files changed, 4 insertions(+), 30 deletions(-) delete mode 100644 requirements-dev.txt diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index 7e745252b91..e3a13a374e6 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -59,15 +59,7 @@ jobs: # Install GMT and other required dependencies from conda-forge - name: Install GMT and required dependencies shell: bash -l {0} - run: | - requirements_file=full-conda-requirements.txt - cat requirements.txt requirements-dev.txt > $requirements_file - cat << EOF >> $requirements_file - gmt=6.1.1 - make - codecov - EOF - conda install --yes --file $requirements_file + run: conda install --yes --file environment.yml # Show installed pkg information for postmortem diagnostic - name: List installed packages diff --git a/MAINTENANCE.md b/MAINTENANCE.md index c6ed5d3477e..10ca1597580 100644 --- a/MAINTENANCE.md +++ b/MAINTENANCE.md @@ -42,7 +42,7 @@ The main advantages of this are: We use GitHub Actions continuous integration (CI) services to build and test the project on Linux, macOS and Windows. -They rely on the `requirements.txt` file to install required dependencies using +They rely on the `environment.yml` file to install required dependencies using conda and the `Makefile` to run the tests and checks. ### GitHub Actions diff --git a/environment.yml b/environment.yml index 85df40af694..2af51c4d945 100644 --- a/environment.yml +++ b/environment.yml @@ -3,7 +3,6 @@ channels: - conda-forge - defaults dependencies: - - python=3.8 - pip - gmt=6.1.1 - numpy @@ -13,12 +12,14 @@ dependencies: - packaging - black - blackdoc + - codecov - coverage[toml] - docformatter - flake8 - ipython - isort>=5 - jupyter + - make - matplotlib - nbsphinx - pylint diff --git a/requirements-dev.txt b/requirements-dev.txt deleted file mode 100644 index 88b7b9da0dc..00000000000 --- a/requirements-dev.txt +++ /dev/null @@ -1,19 +0,0 @@ -# Optional packages for development -black -blackdoc -coverage[toml] -docformatter -flake8 -ipython -isort>=5 -jupyter -matplotlib -nbsphinx -pylint -pytest-cov -pytest-mpl -pytest>=6.0 -sphinx -sphinx-copybutton -sphinx-gallery -sphinx_rtd_theme==0.4.3 From f822ab3ef4b3719e27995dfe48d1660ad98b15c1 Mon Sep 17 00:00:00 2001 From: Wei Ji Date: Mon, 15 Feb 2021 12:55:31 +1300 Subject: [PATCH 3/6] Use `conda env update` instead of `conda install` --- .github/workflows/ci_tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index e3a13a374e6..d234ad3df14 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -59,7 +59,7 @@ jobs: # Install GMT and other required dependencies from conda-forge - name: Install GMT and required dependencies shell: bash -l {0} - run: conda install --yes --file environment.yml + run: conda env update --file environment.yml # Show installed pkg information for postmortem diagnostic - name: List installed packages From 69589590ab3f33088e5b32a4e574981ca34b1836 Mon Sep 17 00:00:00 2001 From: Wei Ji Date: Mon, 15 Feb 2021 14:03:24 +1300 Subject: [PATCH 4/6] Let conda update the 'test' environment, not 'pygmt' --- .github/workflows/ci_tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index d234ad3df14..6bb3b874804 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -59,7 +59,7 @@ jobs: # Install GMT and other required dependencies from conda-forge - name: Install GMT and required dependencies shell: bash -l {0} - run: conda env update --file environment.yml + run: conda env update --name test --file environment.yml # Show installed pkg information for postmortem diagnostic - name: List installed packages From ca703a30f0cc4123199ee8724cb88681ff33ebdc Mon Sep 17 00:00:00 2001 From: Wei Ji Date: Mon, 15 Feb 2021 18:23:25 +1300 Subject: [PATCH 5/6] Let setup miniconda auto activate pygmt conda environment --- .github/workflows/ci_tests.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index 6bb3b874804..b6e3776086b 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -52,6 +52,7 @@ jobs: - name: Setup Miniconda uses: conda-incubator/setup-miniconda@v2.0.1 with: + activate-environment: pygmt python-version: ${{ matrix.python-version }} channels: conda-forge miniconda-version: "latest" @@ -59,7 +60,7 @@ jobs: # Install GMT and other required dependencies from conda-forge - name: Install GMT and required dependencies shell: bash -l {0} - run: conda env update --name test --file environment.yml + run: conda env update --file environment.yml # Show installed pkg information for postmortem diagnostic - name: List installed packages From 4364312b94c844863b9f80e3f248ca0a6e9058f5 Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Thu, 18 Feb 2021 10:02:42 +1300 Subject: [PATCH 6/6] Add section headers to environment.yml file Divide dependency list into `pygmt` required and development dependencies. Co-authored-by: Dongdong Tian --- .github/workflows/ci_tests.yaml | 2 +- environment.yml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index b6e3776086b..da4ade5fa46 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -58,7 +58,7 @@ jobs: miniconda-version: "latest" # Install GMT and other required dependencies from conda-forge - - name: Install GMT and required dependencies + - name: Install dependencies shell: bash -l {0} run: conda env update --file environment.yml diff --git a/environment.yml b/environment.yml index 2af51c4d945..98960605f85 100644 --- a/environment.yml +++ b/environment.yml @@ -3,6 +3,7 @@ channels: - conda-forge - defaults dependencies: + # Required dependencies - pip - gmt=6.1.1 - numpy @@ -10,6 +11,7 @@ dependencies: - xarray - netCDF4 - packaging + # Development dependencies - black - blackdoc - codecov