1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 loguru,
7 pytest-asyncio,
8 pytestCheckHook,
9 pythonOlder,
10 typing-extensions,
11}:
12
13buildPythonPackage rec {
14 pname = "python-utils";
15 version = "3.8.2";
16 format = "setuptools";
17
18 disabled = pythonOlder "3.8";
19
20 src = fetchFromGitHub {
21 owner = "WoLpH";
22 repo = pname;
23 rev = "refs/tags/v${version}";
24 hash = "sha256-2scWyj0Fz39Thu0T0+UirT+he6tPYKGsvmYzzpD+/ls=";
25 };
26
27 postPatch = ''
28 sed -i pytest.ini \
29 -e '/--cov/d' \
30 -e '/--mypy/d'
31 '';
32
33 propagatedBuildInputs = [ typing-extensions ];
34
35 passthru.optional-dependencies = {
36 loguru = [ loguru ];
37 };
38
39 nativeCheckInputs = [
40 pytest-asyncio
41 pytestCheckHook
42 ] ++ passthru.optional-dependencies.loguru;
43
44 pythonImportsCheck = [ "python_utils" ];
45
46 pytestFlagsArray = [ "_python_utils_tests" ];
47
48 disabledTests = lib.optionals stdenv.isDarwin [
49 # Flaky tests on darwin
50 "test_timeout_generator"
51 ];
52
53 meta = with lib; {
54 description = "Module with some convenient utilities";
55 homepage = "https://github.com/WoLpH/python-utils";
56 changelog = "https://github.com/wolph/python-utils/releases/tag/v${version}";
57 license = licenses.bsd3;
58 maintainers = with maintainers; [ ];
59 };
60}