1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5 python,
6
7 # build-system
8 dash,
9 hatchling,
10 hatch-jupyter-builder,
11 pyyaml,
12 setuptools,
13
14 # nativeBuildInputs
15 nodejs,
16
17 # dependencies
18 ipython,
19 numpy,
20 pandas,
21}:
22
23buildPythonPackage rec {
24 pname = "itables";
25 version = "2.5.2";
26
27 # itables has 4 different node packages, each with their own
28 # package-lock.json, and partially depending on each other.
29 # Our fetchNpmDeps tooling in nixpkgs doesn't support this yet, so we fetch
30 # the source tarball from pypi, which includes the javascript bundle already.
31 src = fetchPypi {
32 inherit pname version;
33 hash = "sha256-7DS7rPv0MFVw6nWzaXDeRC+SQSbzcBwyOlpGAY3oTIo=";
34 };
35
36 pyproject = true;
37
38 build-system = [
39 dash
40 hatchling
41 hatch-jupyter-builder
42 pyyaml
43 setuptools
44 ];
45
46 nativeBuildInputs = [
47 nodejs
48 ];
49
50 dependencies = [
51 ipython
52 numpy
53 pandas
54 ];
55
56 # no tests in pypi tarball
57 doCheck = false;
58
59 # don't run the hooks, as they try to invoke npm on packages/,
60 env.HATCH_BUILD_NO_HOOKS = true;
61
62 # The pyproject.toml shipped with the sources doesn't install anything,
63 # as the paths in the pypi tarball are not the same as in the repo checkout.
64 # We exclude itables_for_dash here, as it's missing the .dist-info dir
65 # plumbing to be discoverable, and should be its own package anyways.
66 postInstall = ''
67 cp -R itables $out/${python.sitePackages}
68 '';
69
70 pythonImportsCheck = [ "itables" ];
71
72 meta = {
73 description = "Pandas and Polar DataFrames as interactive DataTables";
74 homepage = "https://github.com/mwouts/itables";
75 changelog = "https://github.com/mwouts/itables/releases/tag/v${version}";
76 license = lib.licenses.mit;
77 maintainers = with lib.maintainers; [ flokli ];
78 };
79}