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