1{ lib
2, stdenv
3, buildPythonPackage
4, fetchFromGitHub
5, fetchpatch
6, llvmPackages
7, zlib
8, cython
9, oldest-supported-numpy
10, setuptools
11, wheel
12, astunparse
13, numpy
14, pyparsing
15, scipy
16, gsd
17, networkx
18, pandas
19, pytest-xdist
20, pytestCheckHook
21, tables
22}:
23
24buildPythonPackage rec {
25 pname = "mdtraj";
26 version = "1.9.9";
27 pyproject = true;
28
29 src = fetchFromGitHub {
30 owner = "mdtraj";
31 repo = "mdtraj";
32 rev = "refs/tags/${version}";
33 hash = "sha256-2Jg6DyVJlRBLD/6hMtcsrAdxKF5RkpUuhAQm/lqVGeE=";
34 };
35
36 patches = [
37 (fetchpatch {
38 name = "gsd_3-compatibility.patch";
39 url = "https://github.com/mdtraj/mdtraj/commit/81209d00817ab07cfc4668bf5ec88088d16904c0.patch";
40 hash = "sha256-ttNmij7csxF0Z5wPPwhGumRX055W2IgFjRAe6nI6GNY=";
41 })
42 ];
43
44 nativeBuildInputs = [
45 cython
46 oldest-supported-numpy
47 setuptools
48 wheel
49 ];
50
51 buildInputs = [
52 zlib
53 ] ++ lib.optionals stdenv.cc.isClang [
54 llvmPackages.openmp
55 ];
56
57 propagatedBuildInputs = [
58 astunparse
59 numpy
60 pyparsing
61 scipy
62 ];
63
64 env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-incompatible-function-pointer-types";
65
66 nativeCheckInputs = [
67 gsd
68 networkx
69 pandas
70 pytest-xdist
71 pytestCheckHook
72 tables
73 ];
74
75 preCheck = ''
76 cd tests
77 export PATH=$out/bin:$PATH
78 '';
79
80 disabledTests = [
81 # require network access
82 "test_pdb_from_url"
83 "test_1vii_url_and_gz"
84
85 # fail due to data race
86 "test_read_atomindices_1"
87 "test_read_atomindices_2"
88
89 # flaky test
90 "test_distances_t"
91 ];
92
93 pythonImportsCheck = [ "mdtraj" ];
94
95 meta = with lib; {
96 description = "An open library for the analysis of molecular dynamics trajectories";
97 homepage = "https://github.com/mdtraj/mdtraj";
98 changelog = "https://github.com/mdtraj/mdtraj/releases/tag/${src.rev}";
99 license = licenses.lgpl21Plus;
100 maintainers = with maintainers; [ natsukium ];
101 };
102}