summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/collections-extended/default.nix
blob: 8ec5841773c5598998e9cc4426b9b3527258c608 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  hypothesis,
  poetry-core,
  pytestCheckHook,
}:

buildPythonPackage rec {
  pname = "collections-extended";
  version = "2.0.2";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "mlenzen";
    repo = "collections-extended";
    tag = "v${version}";
    hash = "sha256-cK13+CQUELKSiLpG747+C+RB5b6luu0mWLLXTT+uGH4=";
  };

  # shuffle's random option has been removed in python 3.11
  postPatch = ''
    substituteInPlace collections_extended/setlists.py \
      --replace-fail \
        "random_.shuffle(self._list, random=random)" \
        "random_.shuffle(self._list)"
  '';

  build-system = [ poetry-core ];

  nativeCheckInputs = [
    hypothesis
    pytestCheckHook
  ];

  pythonImportsCheck = [ "collections_extended" ];

  meta = {
    description = "Extra Python Collections - bags (multisets), setlists (unique list/indexed set), RangeMap and IndexedDict";
    homepage = "https://github.com/mlenzen/collections-extended";
    changelog = "https://github.com/mlenzen/collections-extended/releases/tag/v${version}";
    license = lib.licenses.asl20;
    maintainers = with lib.maintainers; [ exarkun ];
  };
}