2021-02-22 21:28:39 +00:00
|
|
|
{ lib
|
2024-05-15 15:35:15 +00:00
|
|
|
, aiohttp
|
|
|
|
, aiomcache
|
2021-02-22 21:28:39 +00:00
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
2024-05-15 15:35:15 +00:00
|
|
|
, marshmallow
|
2021-02-22 21:28:39 +00:00
|
|
|
, msgpack
|
2024-05-15 15:35:15 +00:00
|
|
|
, pkgs
|
2023-02-16 17:41:37 +00:00
|
|
|
, pythonOlder
|
2024-05-15 15:35:15 +00:00
|
|
|
, pytest-asyncio
|
|
|
|
, pytest-mock
|
|
|
|
, pytestCheckHook
|
2024-04-21 15:54:59 +00:00
|
|
|
, redis
|
|
|
|
, setuptools
|
2021-02-22 21:28:39 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "aiocache";
|
2023-08-10 07:59:29 +00:00
|
|
|
version = "0.12.2";
|
2024-04-21 15:54:59 +00:00
|
|
|
pyproject = true;
|
2023-02-16 17:41:37 +00:00
|
|
|
|
|
|
|
disabled = pythonOlder "3.7";
|
2021-02-22 21:28:39 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "aio-libs";
|
2024-04-21 15:54:59 +00:00
|
|
|
repo = "aiocache";
|
2023-02-16 17:41:37 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2023-08-10 07:59:29 +00:00
|
|
|
hash = "sha256-yvXDNJL8uxReaU81klVWudJwh1hmvg5GeeILcNpm/YA=";
|
2021-02-22 21:28:39 +00:00
|
|
|
};
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace setup.cfg \
|
|
|
|
--replace-fail "--cov=aiocache --cov=tests/ --cov-report term" ""
|
|
|
|
'';
|
|
|
|
|
|
|
|
build-system = [
|
2024-04-21 15:54:59 +00:00
|
|
|
setuptools
|
|
|
|
];
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
optional-dependencies = {
|
2023-02-16 17:41:37 +00:00
|
|
|
redis = [
|
2024-04-21 15:54:59 +00:00
|
|
|
redis
|
2023-02-16 17:41:37 +00:00
|
|
|
];
|
2024-05-15 15:35:15 +00:00
|
|
|
memcached = [
|
|
|
|
aiomcache
|
|
|
|
];
|
2023-02-16 17:41:37 +00:00
|
|
|
msgpack = [
|
|
|
|
msgpack
|
|
|
|
];
|
|
|
|
};
|
2021-02-22 21:28:39 +00:00
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
nativeCheckInputs = [
|
|
|
|
aiohttp
|
|
|
|
marshmallow
|
|
|
|
pytest-asyncio
|
|
|
|
pytest-mock
|
|
|
|
pytestCheckHook
|
|
|
|
] ++ lib.flatten (lib.attrValues optional-dependencies);
|
|
|
|
|
|
|
|
pytestFlagsArray = [
|
|
|
|
"-W" "ignore::DeprecationWarning"
|
|
|
|
# TypeError: object MagicMock can't be used in 'await' expression
|
|
|
|
"--deselect=tests/ut/backends/test_redis.py::TestRedisBackend::test_close"
|
|
|
|
];
|
|
|
|
|
|
|
|
disabledTests = [
|
|
|
|
# calls apache benchmark and fails, no usable output
|
|
|
|
"test_concurrency_error_rates"
|
|
|
|
];
|
|
|
|
|
|
|
|
preCheck = ''
|
|
|
|
${lib.getBin pkgs.redis}/bin/redis-server &
|
|
|
|
REDIS_PID=$!
|
|
|
|
|
|
|
|
${lib.getBin pkgs.memcached}/bin/memcached &
|
|
|
|
MEMCACHED_PID=$!
|
|
|
|
'';
|
|
|
|
|
|
|
|
postCheck = ''
|
|
|
|
kill $REDIS_PID
|
|
|
|
kill $MEMCACHED_PID
|
|
|
|
'';
|
|
|
|
|
|
|
|
__darwinAllowLocalNetworking = true;
|
2023-02-16 17:41:37 +00:00
|
|
|
|
|
|
|
pythonImportsCheck = [
|
|
|
|
"aiocache"
|
|
|
|
];
|
2021-02-22 21:28:39 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Python API Rate Limit Decorator";
|
2023-02-16 17:41:37 +00:00
|
|
|
homepage = "https://github.com/aio-libs/aiocache";
|
|
|
|
changelog = "https://github.com/aio-libs/aiocache/releases/tag/v${version}";
|
2021-02-22 21:28:39 +00:00
|
|
|
license = with licenses; [ bsd3 ];
|
|
|
|
maintainers = with maintainers; [ fab ];
|
|
|
|
};
|
|
|
|
}
|