1{
2 lib,
3 buildPythonPackage,
4 numpy,
5 scipy,
6 pyamg,
7 future,
8 matplotlib,
9 tkinter,
10 mpi4py,
11 scikit-fmm,
12 gmsh,
13 python,
14 stdenv,
15 openssh,
16 fetchFromGitHub,
17 pythonAtLeast,
18 pythonOlder,
19}:
20
21buildPythonPackage rec {
22 pname = "fipy";
23 version = "3.4.5";
24 format = "setuptools";
25
26 # Python 3.12 is not yet supported.
27 # https://github.com/usnistgov/fipy/issues/997
28 # https://github.com/usnistgov/fipy/pull/1023
29 disabled = pythonOlder "3.7" || pythonAtLeast "3.12";
30
31 src = fetchFromGitHub {
32 owner = "usnistgov";
33 repo = "fipy";
34 rev = "refs/tags/${version}";
35 hash = "sha256-345YrGQgHNq0FULjJjLqHksyfm/EHl+KyGfxwS6xK9U=";
36 };
37
38 propagatedBuildInputs = [
39 numpy
40 scipy
41 pyamg
42 matplotlib
43 tkinter
44 mpi4py
45 future
46 scikit-fmm
47 openssh
48 ]
49 ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ gmsh ];
50
51 nativeCheckInputs = lib.optionals (!stdenv.hostPlatform.isDarwin) [ gmsh ];
52
53 # NOTE: Two of the doctests in fipy.matrices.scipyMatrix._ScipyMatrix.CSR fail, and there is no
54 # clean way to disable them.
55 doCheck = false;
56
57 checkPhase = ''
58 export OMPI_MCA_plm_rsh_agent=${openssh}/bin/ssh
59 ${python.interpreter} setup.py test --modules
60 '';
61
62 # NOTE: Importing fipy within the sandbox will fail because plm_rsh_agent isn't set and the process isn't able
63 # to start a daemon on the builder.
64 # pythonImportsCheck = [ "fipy" ];
65
66 meta = with lib; {
67 homepage = "https://www.ctcms.nist.gov/fipy/";
68 description = "Finite Volume PDE Solver Using Python";
69 changelog = "https://github.com/usnistgov/fipy/blob/${version}/CHANGELOG.rst";
70 license = licenses.free;
71 maintainers = with maintainers; [ wd15 ];
72 };
73}