1{
2 lib,
3 buildPythonPackage,
4 fetchpatch,
5 fetchPypi,
6 ipywidgets,
7 looseversion,
8 notebook,
9 pandas,
10 pytestCheckHook,
11}:
12
13buildPythonPackage rec {
14 pname = "qgrid";
15 version = "1.3.1";
16 pyproject = true;
17
18 src = fetchPypi {
19 inherit pname version;
20 hash = "sha256-/or1tQgzCE3AtqJlzRrHuDfAPA+FIRUBY1YNzneNcRw=";
21 };
22
23 patches = [
24 # Fixes compatibility of qgrid with ipywidgets >= 8.0.0
25 # See https://github.com/quantopian/qgrid/pull/331
26 (fetchpatch {
27 url = "https://github.com/quantopian/qgrid/pull/331/commits/8cc50d5117d4208a9dd672418021c59898e2d1b2.patch";
28 hash = "sha256-+NLz4yBUGUXKyukPVE4PehenPzjnfljR5RAX7CEtpV4=";
29 })
30 ];
31
32 postPatch = ''
33 substituteInPlace qgrid/grid.py \
34 --replace-fail "from distutils.version import LooseVersion" "from looseversion import LooseVersion"
35 '';
36
37 dependencies = [
38 ipywidgets
39 looseversion
40 notebook
41 pandas
42 ];
43
44 nativeCheckInputs = [ pytestCheckHook ];
45
46 # Those tests are also failing upstream
47 disabledTests = [
48 "test_edit_date"
49 "test_edit_multi_index_df"
50 "test_multi_index"
51 "test_period_object_column"
52 # probably incompatible with pandas>=2.1
53 "test_add_row_button"
54 ];
55
56 pythonImportsCheck = [ "qgrid" ];
57
58 meta = {
59 description = "Interactive grid for sorting, filtering, and editing DataFrames in Jupyter notebooks";
60 homepage = "https://github.com/quantopian/qgrid";
61 license = lib.licenses.asl20;
62 maintainers = with lib.maintainers; [ GaetanLepage ];
63 };
64}