1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 colorlog,
6 fetchFromGitHub,
7 jinja2,
8 mock,
9 pdm-backend,
10 pylibmc,
11 pystache,
12 pytest-cov-stub,
13 pytestCheckHook,
14 pythonOlder,
15 pyyaml,
16 redis,
17 requests,
18 tabulate,
19 watchdog,
20}:
21
22buildPythonPackage rec {
23 pname = "cement";
24 version = "3.0.14";
25 pyproject = true;
26
27 disabled = pythonOlder "3.8";
28
29 src = fetchFromGitHub {
30 owner = "datafolklabs";
31 repo = "cement";
32 tag = version;
33 hash = "sha256-hZ9kKQmMomjy5nnHKQ2RWB+6vIID8XMn3qutg0wCBq8=";
34 };
35
36 build-system = [ pdm-backend ];
37
38 optional-dependencies = {
39 colorlog = [ colorlog ];
40 jinja2 = [ jinja2 ];
41 mustache = [ pystache ];
42 generate = [ pyyaml ];
43 redis = [ redis ];
44 memcached = [ pylibmc ];
45 tabulate = [ tabulate ];
46 watchdog = [ watchdog ];
47 yaml = [ pyyaml ];
48 cli = [
49 jinja2
50 pyyaml
51 ];
52 };
53
54 nativeCheckInputs = [
55 mock
56 pytest-cov-stub
57 pytestCheckHook
58 requests
59 ]
60 ++ lib.flatten (builtins.attrValues optional-dependencies);
61
62 pythonImportsCheck = [ "cement" ];
63
64 # Tests are failing on Darwin
65 doCheck = !stdenv.hostPlatform.isDarwin;
66
67 disabledTests = [
68 # Test only works with the source from PyPI
69 "test_get_version"
70 ];
71
72 disabledTestPaths = [
73 # Tests require network access
74 "tests/ext/test_ext_memcached.py"
75 "tests/ext/test_ext_redis.py"
76 "tests/ext/test_ext_smtp.py"
77 ];
78
79 meta = with lib; {
80 description = "CLI Application Framework for Python";
81 homepage = "https://builtoncement.com/";
82 changelog = "https://github.com/datafolklabs/cement/blob/${version}/CHANGELOG.md";
83 license = licenses.bsd3;
84 maintainers = with maintainers; [ eqyiel ];
85 mainProgram = "cement";
86 };
87}