nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
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 # optional-dependencies
18 ipython,
19 numpy,
20 pandas,
21 polars,
22 narwhals,
23 matplotlib,
24 anywidget,
25 traitlets,
26 streamlit,
27 marimo,
28 pyarrow,
29 typing-extensions,
30}:
31
32buildPythonPackage rec {
33 pname = "itables";
34 version = "2.6.2";
35
36 # itables has 4 different node packages, each with their own
37 # package-lock.json, and partially depending on each other.
38 # Our fetchNpmDeps tooling in nixpkgs doesn't support this yet, so we fetch
39 # the source tarball from pypi, which includes the javascript bundle already.
40 src = fetchPypi {
41 inherit pname version;
42 hash = "sha256-P3PzBBB022Q3+9L3Loq18kyWhXB2JcCF/3FwHUPkxi8=";
43 };
44
45 pyproject = true;
46
47 build-system = [
48 dash
49 hatchling
50 hatch-jupyter-builder
51 pyyaml
52 setuptools
53 ];
54
55 nativeBuildInputs = [
56 nodejs
57 ];
58
59 # shiny and modin omitted due to missing deps
60 optional-dependencies = {
61 all = [
62 pandas
63 polars
64 narwhals
65 matplotlib
66 ipython
67 anywidget
68 traitlets
69 dash
70 streamlit
71 marimo
72 pyarrow
73 ];
74 pandas = [ pandas ];
75 polars = [ polars ];
76 narwhals = [ narwhals ];
77 style = [
78 pandas
79 matplotlib
80 ];
81 notebook = [ ipython ];
82 widget = [
83 anywidget
84 traitlets
85 ];
86 dash = [
87 dash
88 typing-extensions
89 ];
90 streamlit = [ streamlit ];
91 marimo = [ marimo ];
92 other_dataframes = [
93 narwhals
94 pyarrow
95 ];
96 };
97
98 # no tests in pypi tarball
99 doCheck = false;
100
101 # don't run the hooks, as they try to invoke npm on packages/,
102 env.HATCH_BUILD_NO_HOOKS = true;
103
104 # The pyproject.toml shipped with the sources doesn't install anything,
105 # as the paths in the pypi tarball are not the same as in the repo checkout.
106 # We exclude itables_for_dash here, as it's missing the .dist-info dir
107 # plumbing to be discoverable, and should be its own package anyways.
108 postInstall = ''
109 cp -R itables $out/${python.sitePackages}
110 '';
111
112 pythonImportsCheck = [ "itables" ];
113
114 meta = {
115 description = "Pandas and Polar DataFrames as interactive DataTables";
116 homepage = "https://github.com/mwouts/itables";
117 changelog = "https://github.com/mwouts/itables/releases/tag/v${version}";
118 license = lib.licenses.mit;
119 maintainers = with lib.maintainers; [ flokli ];
120 };
121}