1{
2 lib,
3 pythonOlder,
4 buildPythonPackage,
5 fetchFromGitHub,
6 setuptools-scm,
7 gmt,
8 numpy,
9 pandas,
10 packaging,
11 xarray,
12 pytest-mpl,
13 ipython,
14 ghostscript,
15 pytestCheckHook,
16}:
17
18buildPythonPackage rec {
19 pname = "pygmt";
20 version = "0.16.0";
21 pyproject = true;
22
23 disabled = pythonOlder "3.11";
24
25 src = fetchFromGitHub {
26 owner = "GenericMappingTools";
27 repo = "pygmt";
28 tag = "v${version}";
29 hash = "sha256-VzsSBdKQDSXCFC61eCD6e45GLpVcKjRo3rx+cT/A7Jc=";
30 };
31
32 postPatch = ''
33 substituteInPlace pygmt/clib/loading.py \
34 --replace-fail "env.get(\"GMT_LIBRARY_PATH\")" "env.get(\"GMT_LIBRARY_PATH\", \"${gmt}/lib\")"
35 '';
36
37 build-system = [ setuptools-scm ];
38
39 dependencies = [
40 numpy
41 pandas
42 packaging
43 xarray
44 ];
45
46 nativeCheckInputs = [
47 pytestCheckHook
48 pytest-mpl
49 ghostscript
50 ipython
51 ];
52
53 # The *entire* test suite requires network access
54 doCheck = false;
55
56 postBuild = ''
57 export HOME=$TMP
58 '';
59
60 pythonImportsCheck = [ "pygmt" ];
61
62 meta = {
63 description = "Python interface for the Generic Mapping Tools";
64 homepage = "https://github.com/GenericMappingTools/pygmt";
65 license = lib.licenses.bsd3;
66 changelog = "https://github.com/GenericMappingTools/pygmt/releases/tag/${src.tag}";
67 teams = [ lib.teams.geospatial ];
68 };
69}