Skip to content

Commit

Permalink
feat(loom): Add loom.ociImg attribute
Browse files Browse the repository at this point in the history
Loom docker images attribute exposed as passthru field of loom.

Fixes #12
  • Loading branch information
srounce authored and Schaechtle committed May 23, 2024
1 parent 8703176 commit 4c3715b
Show file tree
Hide file tree
Showing 4 changed files with 144 additions and 123 deletions.
6 changes: 3 additions & 3 deletions envs-flake/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@
basicTools = self.lib.basicTools;
};

scopes = (self.lib.mkScopes pkgs);
scopes = (self.lib.mkScopes {
inherit pkgs;
basicTools = self.lib.basicTools;
});
loom = scopes.callPy3Package ./pkgs/loom { };

packages = loom.more_packages // {
Expand Down
12 changes: 9 additions & 3 deletions lib/mkScopes/default.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
pkgs: let
{ pkgs, basicTools }: let
callPackage = pkgs.newScope (
pkgs
// { inherit callPackage; }
// {
inherit callPackage;
basicTools = basicTools pkgs;
}
);
callPy3Package = pkgs.newScope (
pkgs
// pkgs.python3Packages
// { inherit callPackage; }
// {
inherit callPackage;
basicTools = basicTools pkgs;
}
);
in {
inherit callPackage callPy3Package ;
Expand Down
244 changes: 128 additions & 116 deletions pkgs/loom/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
, zlib
, eigen
, gperftools
, dockerTools
, basicTools
}:
let
goftests = callPackage ./../goftests { };
Expand Down Expand Up @@ -83,131 +85,141 @@ let
# https://github.com/jazzband/contextlib2/pull/52
# updated to support Python3
src = fetchFromGitHub {
owner = "mr-c";
owner = "jazzband";
repo = "contextlib2";
rev = "b8b7eb8ecd9e012178b5dcec4313edded751a459";
hash = "sha256-FSx/vKctoFl4NlwzNDa9eDNUXeW1J875/nB6of+5gQk=";
};
});
in
buildPythonPackage {
inherit version;

src = loom-cpp.dev;

pname = "loom";

nativeBuildInputs = [
cmake
setuptools
wheel
protobuf
];

buildInputs = [
cmake
gnumake

distributions.distributions-shared
distributions
zlib
eigen
gperftools
];

nativeCheckInputs = [
pyflakes
];

# https://github.com/numba/numba/issues/8698#issuecomment-1584888063
env.NUMPY_EXPERIMENTAL_DTYPE_API = 1;

env.DISTRIBUTIONS_USE_PROTOBUF = 1;

propagatedBuildInputs = [
loom-cpp
contextlib2
cpplint
cython_0
distributions
distributions.distributions-shared
goftests
imageio
matplotlib
mock
nose
numpy
pandas
parsable
pep8
python3Packages.protobuf
pyflakes
pymetis
scikit-learn
scipy
setuptools
simplejson
pytest
];

# TODO: make tests run in checkPhase
doCheck = false;

pythonImportsCheck = [
"loom"
"loom.cleanse"
"loom.crossvalidate"
"loom.datasets"
"loom.format"
"loom.generate"
"loom.preql"
"loom.query"
"loom.schema_pb2"
"loom.store"
"loom.tasks"
"loom.transforms"
"loom.util"
"loom.watch"
];

dontUseCmakeConfigure = true;

enableParallelBuilding = true;

prePatch = ''
sed -i 's/-Werror//g' CMakeLists.txt # remove -Werror
'';

passthru.loom-cpp = loom-cpp;

passthru.more_packages = {
inherit

loom = buildPythonPackage {
inherit version;

src = loom-cpp.dev;

pname = "loom";

nativeBuildInputs = [
cmake
setuptools
wheel
protobuf
];

buildInputs = [
cmake
gnumake

distributions.distributions-shared
distributions
zlib
eigen
gperftools
];

nativeCheckInputs = [
pyflakes
];

# https://github.com/numba/numba/issues/8698#issuecomment-1584888063
env.NUMPY_EXPERIMENTAL_DTYPE_API = 1;

env.DISTRIBUTIONS_USE_PROTOBUF = 1;

propagatedBuildInputs = [
loom-cpp
contextlib2
cpplint
cython_0
distributions
distributions.distributions-shared
goftests
imageio
matplotlib
mock
nose
numpy
pandas
parsable
pep8
python3Packages.protobuf
pyflakes
pymetis
scikit-learn
scipy
setuptools
simplejson
pytest
];

# TODO: make tests run in checkPhase
doCheck = false;

pythonImportsCheck = [
"loom"
"loom.cleanse"
"loom.crossvalidate"
"loom.datasets"
"loom.format"
"loom.generate"
"loom.preql"
"loom.query"
"loom.schema_pb2"
"loom.store"
"loom.tasks"
"loom.transforms"
"loom.util"
"loom.watch"
];

dontUseCmakeConfigure = true;

enableParallelBuilding = true;

prePatch = ''
sed -i 's/-Werror//g' CMakeLists.txt # remove -Werror
'';

passthru.loom-cpp = loom-cpp;

passthru.more_packages = {
inherit
goftests
distributions
pymetis
parsable
;
};
;
};

passthru.tests.run = callPackage ./test.nix { inherit src; };

passthru.test-shell = callPackage ({
mkShell
, python3
, loom
, which
}: mkShell {
packages = [
python3
loom
which
];
}) {};
passthru.ociImg = dockerTools.buildLayeredImage {
name = "probcomp/loom";
contents =
with pkgs; [ loom bashInteractive ] ++
basicTools
;
};

meta = with lib; {
description = "A streaming cross-cat inference engine";
homepage = "https://github.com/emilyfertig/loom";
license = licenses.bsd3;
maintainers = with maintainers; [ ];
passthru.tests.run = callPackage ./test.nix { inherit src; };

passthru.test-shell = callPackage ({
mkShell
, python3
, loom
, which
}: mkShell {
packages = [
python3
loom
which
];
}) {};

meta = with lib; {
description = "A streaming cross-cat inference engine";
homepage = "https://github.com/emilyfertig/loom";
license = licenses.bsd3;
maintainers = with maintainers; [ ];
};
};
}
in
loom

0 comments on commit 4c3715b

Please sign in to comment.