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 ] ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ gmsh ];
49
50 nativeCheckInputs = lib.optionals (!stdenv.hostPlatform.isDarwin) [ gmsh ];
51
52 # NOTE: Two of the doctests in fipy.matrices.scipyMatrix._ScipyMatrix.CSR fail, and there is no
53 # clean way to disable them.
54 doCheck = false;
55
56 checkPhase = ''
57 export OMPI_MCA_plm_rsh_agent=${openssh}/bin/ssh
58 ${python.interpreter} setup.py test --modules
59 '';
60
61 # NOTE: Importing fipy within the sandbox will fail because plm_rsh_agent isn't set and the process isn't able
62 # to start a daemon on the builder.
63 # pythonImportsCheck = [ "fipy" ];
64
65 meta = with lib; {
66 homepage = "https://www.ctcms.nist.gov/fipy/";
67 description = "Finite Volume PDE Solver Using Python";
68 changelog = "https://github.com/usnistgov/fipy/blob/${version}/CHANGELOG.rst";
69 license = licenses.free;
70 maintainers = with maintainers; [ wd15 ];
71 };
72}