From 3ad3c3c52a5be6a9d905620d7deb598ac1364f82 Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Sun, 14 Mar 2021 17:01:55 +1300 Subject: [PATCH 1/2] Setup poetry in pyproject.toml Translating the Python specific dependencies inside the conda environment.yml file into poetry. Project metadata and required dependencies are copied from setup.py. There are also optional dependencies for building sphinx documentation and development specific dependencies for testing. --- .gitignore | 1 + pyproject.toml | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/.gitignore b/.gitignore index 7e3800a3b1c..0d08c70ef29 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ dist/ *.egg-info/ .eggs/ MANIFEST +poetry.lock # Unit test / coverage reports .cache diff --git a/pyproject.toml b/pyproject.toml index b147a80a911..3f7223ae519 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,47 @@ +[tool.poetry] +name = "pygmt" +version = "0.3.1" +description = "A Python interface for the Generic Mapping Tools" +authors = ["The PyGMT Developers"] +license = "BSD License" + +[tool.poetry.dependencies] +myst-parser = {version = "*", optional = true} +netCDF4 = "*" +numpy = "*" +packaging = "*" +pandas = "*" +python = "^3.7" +sphinx = {version = "*", optional = true} +sphinx-copybutton = {version = "*", optional = true} +sphinx-gallery = {version = "*", optional = true} +sphinx_rtd_theme = {version = "0.4.3", optional = true} +xarray = "*" + +[tool.poetry.dev-dependencies] +black = "*" +blackdoc = "*" +codecov = "*" +coverage = {extras = ["toml"], version = "*"} +docformatter = "*" +flake8 = "*" +ipython = "*" +isort = ">=5" +jupyter = "*" +make = "*" +matplotlib = "*" +pylint = "*" +pytest-cov = "*" +pytest-mpl = "*" +pytest = ">=6.0" + +[tool.poetry.extras] +docs = ["myst-parser", "sphinx", "sphinx-copybutton", "sphinx-gallery", "sphinx_rtd_theme"] + +[build-system] +requires = ["poetry-core>=1.0.0"] +build-backend = "poetry.core.masonry.api" + [tool.coverage.run] omit = ["*/tests/*", "*pygmt/__init__.py"] From 9e8820dee578fc36005a8ae9b47bcf7b5ad7f792 Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Sun, 14 Mar 2021 17:08:13 +1300 Subject: [PATCH 2/2] Let ci_tests use conda for non-Python deps and poetry for Python deps Only installing GMT and make via conda, plus poetry just to make things easy. The PyGMT package and all the necessary Python dependencies are installed using poetry. --- .github/workflows/ci_tests.yaml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index 0ac19e209a4..ce3a7717219 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -79,7 +79,7 @@ jobs: # Install GMT and other required dependencies from conda-forge - name: Install dependencies - run: conda env update --file environment.yml + run: conda install gmt=6.1.1 make poetry # Show installed pkg information for postmortem diagnostic - name: List installed packages @@ -105,9 +105,7 @@ jobs: # Install the package that we want to test - name: Install the package - run: | - python setup.py sdist --formats=zip - pip install dist/* + run: poetry install --extras docs # Run the tests - name: Test with pytest