1{
2 lib,
3 aiohttp,
4 aiomcache,
5 buildPythonPackage,
6 fetchFromGitHub,
7 marshmallow,
8 memcachedTestHook,
9 msgpack,
10 pytest-asyncio,
11 pytest-cov-stub,
12 pytest-mock,
13 pytestCheckHook,
14 pythonAtLeast,
15 pythonOlder,
16 redis,
17 redisTestHook,
18 setuptools,
19}:
20
21buildPythonPackage rec {
22 pname = "aiocache";
23 version = "0.12.3";
24 pyproject = true;
25
26 disabled = pythonOlder "3.8";
27
28 src = fetchFromGitHub {
29 owner = "aio-libs";
30 repo = "aiocache";
31 tag = "v${version}";
32 hash = "sha256-4QYCRXMWlt9fsiWgUTc2pKzXG7AG/zGmd4HT5ggIZNM=";
33 };
34
35 build-system = [ setuptools ];
36
37 optional-dependencies = {
38 redis = [ redis ];
39 memcached = [ aiomcache ];
40 msgpack = [ msgpack ];
41 };
42
43 nativeCheckInputs = [
44 aiohttp
45 marshmallow
46 memcachedTestHook
47 pytest-asyncio
48 pytest-cov-stub
49 pytest-mock
50 pytestCheckHook
51 redisTestHook
52 ] ++ lib.flatten (lib.attrValues optional-dependencies);
53
54 pytestFlagsArray = [
55 "-W"
56 "ignore::DeprecationWarning"
57 # TypeError: object MagicMock can't be used in 'await' expression
58 "--deselect=tests/ut/backends/test_redis.py::TestRedisBackend::test_close"
59 ];
60
61 disabledTests =
62 [
63 # Test calls apache benchmark and fails, no usable output
64 "test_concurrency_error_rates"
65 ]
66 ++ lib.optionals (pythonAtLeast "3.13") [
67 # https://github.com/aio-libs/aiocache/issues/863
68 "test_cache_write_doesnt_wait_for_future"
69 ];
70
71 disabledTestPaths = [
72 # Benchmark and performance tests are not relevant for Nixpkgs
73 "tests/performance/"
74 ];
75
76 __darwinAllowLocalNetworking = true;
77
78 pythonImportsCheck = [ "aiocache" ];
79
80 meta = with lib; {
81 description = "Python API Rate Limit Decorator";
82 homepage = "https://github.com/aio-libs/aiocache";
83 changelog = "https://github.com/aio-libs/aiocache/releases/tag/v${version}";
84 license = licenses.bsd3;
85 maintainers = with maintainers; [ fab ];
86 };
87}