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