1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, fetchpatch
5, pytestCheckHook
6, pythonAtLeast
7, pythonOlder
8}:
9
10buildPythonPackage rec {
11 pname = "boltons";
12 version = "21.0.0";
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-8HO7X2PQEbQIQsCa2cMHQI3rlofVT22GYrWNXY34MLk=";
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 # Tests bind to localhost
38 __darwinAllowLocalNetworking = true;
39
40 pythonImportsCheck = [
41 "boltons"
42 ];
43
44 meta = with lib; {
45 homepage = "https://github.com/mahmoud/boltons";
46 description = "Constructs, recipes, and snippets extending the Python standard library";
47 longDescription = ''
48 Boltons is a set of over 200 BSD-licensed, pure-Python utilities
49 in the same spirit as - and yet conspicuously missing from - the
50 standard library, including:
51
52 - Atomic file saving, bolted on with fileutils
53 - A highly-optimized OrderedMultiDict, in dictutils
54 - Two types of PriorityQueue, in queueutils
55 - Chunked and windowed iteration, in iterutils
56 - Recursive data structure iteration and merging, with iterutils.remap
57 - Exponential backoff functionality, including jitter, through
58 iterutils.backoff
59 - A full-featured TracebackInfo type, for representing stack
60 traces, in tbutils
61 '';
62 license = licenses.bsd3;
63 maintainers = with maintainers; [ twey ];
64 };
65}