1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 django,
6 django-debug-toolbar,
7 psycopg2,
8 jinja2,
9 beautifulsoup4,
10 pytest-django,
11 pytestCheckHook,
12 python,
13 pytz,
14 redis,
15 redisTestHook,
16 setuptools,
17 stdenv,
18}:
19
20buildPythonPackage rec {
21 pname = "django-cachalot";
22 version = "2.8.0";
23 format = "setuptools";
24
25 src = fetchFromGitHub {
26 owner = "noripyt";
27 repo = "django-cachalot";
28 tag = "v${version}";
29 hash = "sha256-3W+9cULL3mMtAkxbqetoIj2FL/HRbzWHIDMe9O1e6BM=";
30 };
31
32 patches = [
33 # Disable tests for unsupported caching and database types which would
34 # require additional running backends
35 ./disable-unsupported-tests.patch
36 ];
37
38 build-system = [ setuptools ];
39
40 dependencies = [ django ];
41
42 nativeCheckInputs = [
43 beautifulsoup4
44 django-debug-toolbar
45 psycopg2
46 jinja2
47 pytest-django
48 pytestCheckHook
49 pytz
50 redis
51 redisTestHook
52 ];
53
54 pythonImportsCheck = [ "cachalot" ];
55
56 # redisTestHook does not work on darwin
57 doCheck = !stdenv.hostPlatform.isDarwin;
58
59 preCheck = ''
60 export DJANGO_SETTINGS_MODULE=settings
61 '';
62
63 pytestFlags = [
64 "-o python_files=*.py"
65 "-o collect_imported_tests=false"
66 "cachalot/tests"
67 "cachalot/admin_tests"
68 ];
69
70 disabledTests = [
71 # relies on specific EXPLAIN output format from sqlite, which is not stable
72 "test_explain"
73 # broken on django-debug-toolbar 6.0
74 "test_rendering"
75 ];
76
77 meta = with lib; {
78 description = "No effort, no worry, maximum performance";
79 homepage = "https://github.com/noripyt/django-cachalot";
80 changelog = "https://github.com/noripyt/django-cachalot/blob/${src.tag}/CHANGELOG.rst";
81 license = licenses.bsd3;
82 maintainers = with maintainers; [ onny ];
83 };
84}