1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 pythonOlder,
6 fetchFromGitHub,
7 beautifulsoup4,
8 boto3,
9 freezegun,
10 hatchling,
11 lxml,
12 openpyxl,
13 parameterized,
14 pdoc,
15 pytestCheckHook,
16 requests-mock,
17 typeguard,
18}:
19
20buildPythonPackage rec {
21 pname = "bx-py-utils";
22 version = "113";
23
24 disabled = pythonOlder "3.10";
25
26 pyproject = true;
27
28 src = fetchFromGitHub {
29 owner = "boxine";
30 repo = "bx_py_utils";
31 tag = "v${version}";
32 hash = "sha256-rpDRLiqcbg/aRzdmKwGJAGrhBJTA+7tXsjPUIeeC03I=";
33 };
34
35 postPatch = ''
36 rm bx_py_utils_tests/publish.py
37 '';
38
39 build-system = [ hatchling ];
40
41 pythonImportsCheck = [
42 "bx_py_utils.anonymize"
43 "bx_py_utils.auto_doc"
44 "bx_py_utils.compat"
45 "bx_py_utils.dict_utils"
46 "bx_py_utils.environ"
47 "bx_py_utils.error_handling"
48 "bx_py_utils.file_utils"
49 "bx_py_utils.graphql_introspection"
50 "bx_py_utils.hash_utils"
51 "bx_py_utils.html_utils"
52 "bx_py_utils.iteration"
53 "bx_py_utils.path"
54 "bx_py_utils.processify"
55 "bx_py_utils.rison"
56 "bx_py_utils.stack_info"
57 "bx_py_utils.string_utils"
58 "bx_py_utils.test_utils"
59 "bx_py_utils.text_tools"
60 ];
61
62 nativeCheckInputs = [
63 beautifulsoup4
64 boto3
65 freezegun
66 lxml
67 openpyxl
68 parameterized
69 pdoc
70 pytestCheckHook
71 requests-mock
72 typeguard
73 ];
74
75 disabledTests = [
76 # too closely affected by bs4 updates
77 "test_pretty_format_html"
78 "test_assert_html_snapshot_by_css_selector"
79 # test accesses the internet
80 "test_happy_path"
81 # test assumes a virtual environment
82 "test_code_style"
83 ];
84
85 disabledTestPaths = [
86 # depends on cli-base-utilities, which depends on bx-py-utils
87 "bx_py_utils_tests/tests/test_project_setup.py"
88 ]
89 ++ lib.optionals stdenv.hostPlatform.isDarwin [
90 # processify() doesn't work under darwin
91 # https://github.com/boxine/bx_py_utils/issues/80
92 "bx_py_utils_tests/tests/test_processify.py"
93 ];
94
95 meta = {
96 description = "Various Python utility functions";
97 mainProgram = "bx_py_utils";
98 homepage = "https://github.com/boxine/bx_py_utils";
99 changelog = "https://github.com/boxine/bx_py_utils/releases/tag/${src.tag}";
100 license = lib.licenses.mit;
101 maintainers = with lib.maintainers; [ dotlambda ];
102 };
103}