Skip to content

Commit e8f62d6

Browse files
committedMar 19, 2025
python312Packages.conduit[-mpi]: init at 0.9.3
1 parent e803c9d commit e8f62d6

File tree

3 files changed

+79
-0
lines changed

3 files changed

+79
-0
lines changed
 

‎pkgs/by-name/co/conduit/package.nix

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
# passthru
99
conduit,
10+
python3Packages,
1011
nix-update-script,
1112

1213
mpiSupport ? false,
@@ -50,6 +51,8 @@ stdenv.mkDerivation (finalAttrs: {
5051
passthru = {
5152
tests = {
5253
withMpi = conduit.override { mpiSupport = true; };
54+
pythonModule = python3Packages.conduit;
55+
pythonModuleWithMpi = python3Packages.conduit.override { mpiSupport = true; };
5356
};
5457
updateScript = nix-update-script { };
5558
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
{
2+
lib,
3+
pkgs,
4+
buildPythonPackage,
5+
setuptools,
6+
numpy,
7+
pip,
8+
openmpi,
9+
10+
mpiSupport ? false,
11+
}:
12+
let
13+
conduit = pkgs.conduit.override { inherit mpiSupport; };
14+
15+
# As cmake is invoked by setup.py, adding openmpi to buildInputs is not enough for it to be found.
16+
# It is necessary to explicitly provide openmpi's location through cmake flags.
17+
mpi = lib.getDev openmpi;
18+
mpiCmakeFlags = lib.concatStringsSep "', '" [
19+
(lib.cmakeFeature "MPI_C_COMPILER" (lib.getExe' mpi "mpicc"))
20+
(lib.cmakeFeature "MPI_CXX_COMPILER" (lib.getExe' mpi "mpicxx"))
21+
];
22+
in
23+
buildPythonPackage {
24+
inherit (conduit)
25+
pname
26+
version
27+
src
28+
nativeBuildInputs
29+
buildInputs
30+
;
31+
32+
postPatch =
33+
''
34+
substituteInPlace setup.py \
35+
--replace-fail \
36+
"'-j2'" \
37+
"f'-j{os.environ.get(\"NIX_BUILD_CORES\")}'"
38+
''
39+
+ lib.optionalString mpiSupport ''
40+
substituteInPlace setup.py \
41+
--replace-fail \
42+
"cmake_args = [" \
43+
"cmake_args = ['${mpiCmakeFlags}', "
44+
'';
45+
46+
pyproject = true;
47+
dontUseCmakeConfigure = true;
48+
49+
env.ENABLE_MPI = mpiSupport;
50+
51+
build-system = [
52+
setuptools
53+
numpy
54+
pip
55+
];
56+
57+
pythonImportsCheck = [ "conduit" ];
58+
59+
# No python tests
60+
doCheck = false;
61+
62+
meta = {
63+
description = "Python bindings for the conduit library";
64+
inherit (conduit.meta)
65+
homepage
66+
changelog
67+
license
68+
platforms
69+
;
70+
maintainers = with lib.maintainers; [ GaetanLepage ];
71+
};
72+
}

‎pkgs/top-level/python-packages.nix

+4
Original file line numberDiff line numberDiff line change
@@ -2646,6 +2646,10 @@ self: super: with self; {
26462646

26472647
conda-package-streaming = callPackage ../development/python-modules/conda-package-streaming { };
26482648

2649+
conduit = callPackage ../development/python-modules/conduit { };
2650+
2651+
conduit-mpi = callPackage ../development/python-modules/conduit { mpiSupport = true; };
2652+
26492653
confection = callPackage ../development/python-modules/confection { };
26502654

26512655
configargparse = callPackage ../development/python-modules/configargparse { };

0 commit comments

Comments
 (0)
Failed to load comments.