nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, fetchpatch
5, pytestCheckHook
6, pythonAtLeast
7, pythonOlder
8}:
9
10buildPythonPackage rec {
11 pname = "boltons";
12 version = "20.2.1";
13 format = "setuptools";
14
15 disabled = pythonOlder "3.7";
16
17 src = fetchFromGitHub {
18 owner = "mahmoud";
19 repo = "boltons";
20 rev = version;
21 hash = "sha256-iCueZsi/gVbko7MW43vaUQMWRVI/YhmdfN29gD6AgG8=";
22 };
23
24 checkInputs = [
25 pytestCheckHook
26 ];
27
28 patches = lib.optionals (pythonAtLeast "3.10") [
29 # pprint has no attribute _safe_repr, https://github.com/mahmoud/boltons/issues/294
30 (fetchpatch {
31 name = "fix-pprint-attribute.patch";
32 url = "https://github.com/mahmoud/boltons/commit/270e974975984f662f998c8f6eb0ebebd964de82.patch";
33 sha256 = "sha256-pZLfr6SRCw2aLwZeYaX7bzfJeZC4cFUILEmnVsKR6zc=";
34 })
35 ];
36
37 disabledTests = [
38 # This test is broken without this PR. Merged but not released
39 # https://github.com/mahmoud/boltons/pull/283
40 "test_frozendict"
41 ];
42
43 pythonImportsCheck = [
44 "boltons"
45 ];
46
47 meta = with lib; {
48 homepage = "https://github.com/mahmoud/boltons";
49 description = "Constructs, recipes, and snippets extending the Python standard library";
50 longDescription = ''
51 Boltons is a set of over 200 BSD-licensed, pure-Python utilities
52 in the same spirit as - and yet conspicuously missing from - the
53 standard library, including:
54
55 - Atomic file saving, bolted on with fileutils
56 - A highly-optimized OrderedMultiDict, in dictutils
57 - Two types of PriorityQueue, in queueutils
58 - Chunked and windowed iteration, in iterutils
59 - Recursive data structure iteration and merging, with iterutils.remap
60 - Exponential backoff functionality, including jitter, through
61 iterutils.backoff
62 - A full-featured TracebackInfo type, for representing stack
63 traces, in tbutils
64 '';
65 license = licenses.bsd3;
66 maintainers = with maintainers; [ twey ];
67 };
68}